2

I'm using fusioncharts in my asp.net application. Using xml as the data source the application works fine, but with JSON it's not working and that's after I set the data format of the FusionChart class to "json", like this:

(FusionCharts.SetDataFormat("json")) 

and pass the .json data file to the RenderChartHTML function:

Literal1.Text = FusionCharts.RenderChartHTML("FusionCharts/FCF_MSColumn3D.swf",
    "Data/Data3.json", "", "BPOR", "700", "500", false);

The JSON format is correct, because I have validated it on JSONLint.

Any help resolving this issue is appreciated.

  1. The error message says: Error in loading data.

  2. I am using FusionCharts Free

  3. Here is the code:

    {
        "chart":{
            "caption":"Business Results 2005 v 2006",
            "xaxisname":"Month",
            "yaxisname":"Revenue",
            "showvalues":"0",
            "numberprefix":"$"
        },
    
        "categories":[{
            "category":[
            {  "label":"Jan"   },
            {  "label":"Feb"   },
            {  "label":"Mar"   },
            {  "label":"Apr"   },
            {  "label":"May"   },
            {  "label":"Jun"   },
            {  "label":"Jul"   },
            {  "label":"Aug"   },
            {  "label":"Sep"   },
            {  "label":"Oct"   },
            {  "label":"Nov"   },
            {  "label":"Dec"   }
            ]
        }
      ],
    
        "dataset":[{
            "seriesname":"2006",
            "data":[
            { "value":"27400"  },
            { "value":"29800"  },
            { "value":"25800"  },
            { "value":"26800"  },
            { "value":"29600"  },
            { "value":"32600"  },
            { "value":"31800"  },
            { "value":"36700"  },
            { "value":"29700"  },
            { "value":"31900"  },
            { "value":"34800"  },
            { "value":"24800"  }
            ]
        },
    
        {
        "seriesname":"2005",
        "data":[
            { "value":"10000"  },
            { "value":"11500"  },
            { "value":"12500"  },
            { "value":"15000"  },
            { "value":"11000"  },
            { "value":"9800"   },
            { "value":"11800"  },
            { "value":"19700"  },
            { "value":"21700"  },
            { "value":"21900"  },
            { "value":"22900"  },
            { "value":"20800"  }
        ]
        }
     ]
    }
    
5
  • 3
    What is the error message? Commented Aug 11, 2013 at 2:31
  • Are you using FusionCharts Free or v3? Commented Aug 11, 2013 at 4:44
  • Can you paste the json code here? Commented Aug 11, 2013 at 9:19
  • Thank you for the response. I am using FusionCharts Free. The error message says: Error in loading data Commented Aug 11, 2013 at 16:35
  • FusionCharts Free does not support JSON format. Try using the Evaluation version of FusionCharts XT which will support JSON/XML format. Commented Aug 12, 2013 at 4:01

1 Answer 1

2

FusionCharts Free does not support JSON format. Try using the Evaluation version of FusionCharts XT which will support JSON/XML format.

Otherwise,there is a JSON to XML converter for FusionCharts

http://docs.fusioncharts.com/charts/Tools/FCDataConverter/

If your data is static, it is recommended to convert the JSON to XML and use it. So as far as your JSON is concerned, use this XML code and try.

<chart caption="Business Results 2005 v 2006" xaxisname="Month" yaxisname="Revenue" showvalues="0" numberprefix="$" >
<categories>
    <category label="Jan" />
    <category label="Feb" />
    <category label="Mar" />
    <category label="Apr" />
    <category label="May" />
    <category label="Jun" />
    <category label="Jul" />
    <category label="Aug" />
    <category label="Sep" />
    <category label="Oct" />
    <category label="Nov" />
    <category label="Dec" />
</categories>
<dataset seriesname="2006">
    <set value="27400" />
    <set value="29800" />
    <set value="25800" />
    <set value="26800" />
    <set value="29600" />
    <set value="32600" />
    <set value="31800" />
    <set value="36700" />
    <set value="29700" />
    <set value="31900" />
    <set value="34800" />
    <set value="24800" />
</dataset>
<dataset seriesname="2005">
    <set value="10000" />
    <set value="11500" />
    <set value="12500" />
    <set value="15000" />
    <set value="11000" />
    <set value="9800" />
    <set value="11800" />
    <set value="19700" />
    <set value="21700" />
    <set value="21900" />
    <set value="22900" />
    <set value="20800" />
</dataset>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.