How to splice a dual-axis graph in the JSON format of FusionCharts, fusionchartsjson
1. Problem background
Assume that a problem occurs in the project: Use the JSON format in FusionCharts to splice a dual-axis graph, convert the JSON string into a JSON object, and transmit it to the foreground, which is displayed on the page.
2. Design source code
/***** @ Title: DoubleYaxis. java * @ Package: com. you. utils * @ Description:
Running result:
FusionChart dual-axis diagram of multiple series charts: {"chart": {"caption": "sales distribution in December", "xaxisname": "month", "yaxisname": "sales ", "showvalues": "0"}, "categories": [{"category": [{"label": "January" },{ "label": "February "}, {"label": "March" },{ "label": "April" },{ "label": "May" },{ "label": "June "}, {"label": "July" },{ "label": "August" },{ "label": "September" },{ "label": "October "}, {"label": "November" },{ "label": "December"}], "dataset": [{"seriesname": "apple ", "data": [{"value": "100" },{ "value": "200" },{ "value": "300" },{ "value ": "400" },{ "value": "500" },{ "value": "600" },{ "value": "700" },{ "value ": "800" },{ "value": "900" },{ "value": "1000" },{ "value": "1100" },{ "value ": "1200"}] },{ "seriesname": "orange", "parentyaxis": "S", "data": [{"value": "200 "}, {"value": "400" },{ "value": "600" },{ "value": "800" },{ "value": "1000 "}, {"value": "1200" },{ "value": "1400" },{ "value": "1600" },{ "value": "1800 "}, {"value": "2000" },{ "value": "2200" },{ "value": "2400"}]}
3. After formatting
{"Chart": {"caption": "2014 sales distribution", "xaxisname": "sales", "yaxisname": "People", "showvalues ": "0"}, "categories": [{"category": [{"label": "January" },{ "label": "February "}, {"label": "March" },{ "label": "April" },{ "label": "May" },{ "label": "June "}, {"label": "July" },{ "label": "August" },{ "label": "September" },{ "label": "October "}, {"label": "November" },{ "label": "December"}], "dataset": [{"seriesname": "apple ", "data": [{"value": "100" },{ "value": "200" },{ "value": "300" },{ "value ": "400" },{ "value": "500" },{ "value": "600" },{ "value": "700" },{ "value ": "800" },{ "value": "900" },{ "value": "1000" },{ "value": "1100" },{ "value ": "1200"}] },{ "seriesname": "orange", "parentyaxis": "S", "data": [{"value": "200 "}, {"value": "400" },{ "value": "600" },{ "value": "800" },{ "value": "1000 "}, {"value": "1200" },{ "value": "1400" },{ "value": "1600" },{ "value": "1800 "}, {"value": "2000" },{ "value": "2200" },{ "value": "2400"}]}