Jim van Gulik Report post Posted February 13, 2013 (edited) Hi, I am testing Fusion Charts with JSON serialization. The data required by Fusion Charts is (for example): { "chart": {"lowerlimit":"0","upperlimit":"100","lowerlimitdisplay":"Bad","upperlimitdisplay":"Good","numbersuffix":"%","showvalue":"1"}, "colorrange": {"color":[ {"minvalue":"0","maxvalue":"75","code":"FF654F"}, {"minvalue":"75","maxvalue":"90","code":"F6BD0F"}, {"minvalue":"90","maxvalue":"100","code":"8BBA00"} ] }, "dials":{"dial":[{"value":"92"}]}} I have created a ChartData class with a Chart property and a collection List<Color> ColorRange; When I serialize the data, this is the result: { "chart":{"lowerlimit":"0","lowerlimitdisplay":"bad","numbersuffix":"%","showvalue":"1","upperlimit":"100","upperlimitdisplay":"good"}, "colorrange":[ {"code":"ff654f","maxvalue":"75","minvalue":"0"}, {"code":"f6bd0f","maxvalue":"90","minvalue":"75"}, {"code":"8bba00","maxvalue":"100","minvalue":"90"} ] } .... The problem is that .NET doesn't serialize the "color" TypeName. I have been looking at standard .NET and I even have been testing JSON.NET, but I can't seem to make this work. So I need: "colorrange":{"color": {"code":" ... Instead of: "colorrange":[ {"code":"ff654f"," Do you have a sample code or application where .NET is used to provide Fusion Charts with JSON data? Thanks in advance Jim Edited February 13, 2013 by Jim van Gulik Share this post Link to post Share on other sites
Sanjukta Report post Posted February 15, 2013 Hi, On 2/13/2013 at 12:20 PM, Jim van Gulik said: Hi, I am testing Fusion Charts with JSON serialization. The data required by Fusion Charts is (for example): The problem is that .NET doesn't serialize the "color" TypeName. I have been looking at standard .NET and I even have been testing JSON.NET, but I can't seem to make this work. So I need: "colorrange":{"color": {"code":" ... Instead of: "colorrange":[ {"code":"ff654f"," Do you have a sample code or application where .NET is used to provide Fusion Charts with JSON data? Thanks in advance Jim Could you please let us know the Chart Type that you are using so that we are able to assist you with a sample using ASP.Net and JSON data? Awaiting your reply. Share this post Link to post Share on other sites
Jim van Gulik Report post Posted February 15, 2013 Sanjukta said: 1360916138[/url]' post='52113']Hi, Could you please let us know the Chart Type that you are using so that we are able to assist you with a sample using ASP.Net and JSON data? Awaiting your reply. It's a very basic Line chart. A sample would be great, thanks! Share this post Link to post Share on other sites
Sanjukta Report post Posted February 15, 2013 Hi, On 2/15/2013 at 8:29 AM, Jim van Gulik said: It's a very basic Line chart. A sample would be great, thanks! Please check with the attached "LineChartJSON" sample attached with this post. Also, please refer to the following links for details on the JSON data format that FusionCharts currently supports. You would need to use only this format in order to feed JSON data to the chart. Ref.- http://docs.fusioncharts.com/charts/contents/?DataFormats/JSON/Overview.html http://docs.fusioncharts.com/charts/contents/?guide-for-web-developers/csnet/CS_BasicExample.html#json Hope this helps. LineChartJSON.zip Share this post Link to post Share on other sites
Jim van Gulik Report post Posted February 27, 2013 On 2/15/2013 at 11:04 AM, Sanjukta said: Hi, Hope this helps. Thanks for the effort! Although this wasn't really what I meant. You have provided an example where the JSON data is read from a file. My problem occured with JSON serialization (from a webservice or MVC controller). However, I have managed to get it to work. I have added some extra properties which resulted in the correct JSON format. Thanks anyway! Regards, Jim Share this post Link to post Share on other sites
Sanjukta Report post Posted February 27, 2013 Hi Jim, On 2/27/2013 at 8:27 AM, Jim van Gulik said: Thanks for the effort! Although this wasn't really what I meant. You have provided an example where the JSON data is read from a file. My problem occured with JSON serialization (from a webservice or MVC controller). However, I have managed to get it to work. I have added some extra properties which resulted in the correct JSON format. Thanks anyway! Regards, Jim Glad that your issue is resolved. Happy FusionCharting! Share this post Link to post Share on other sites