JSON Structure for Highchart Line

Asked

Viewed 381 times

2

I would like to know what would be the correct structure to create a LINE chart in Highcharts with dynamic data: Example http://jsfiddle.net/gumaro/6u4Ha/2/

I have values that I want to show in a row, their evolution during the months, but I don’t have all the months filled and so the graph would start in the middle of the year (for example).

What would be the best way to do JSON to fill the X axis with the referring months along with the values?

  • Could you give more details? Could you post any attempts you’ve already made?

  • I’m not sure I really understand what you want in response. If you’re talking about the JSON format, you can do something like the below: {"Result":[["Maio", "Junho", "Julho"], [20, 30, 15]]} Then when using do: ;Result[0] //X Result[1] //Y If that’s not what you want, comment more details there to make it easier to help you.

  • @Erloncharles I don’t know if this helps: http://pastebin.com/5yM4uFNL

  • @Renattomachado That way I wouldn’t need to put values in "Series"?

  • @gumaro Yes. It will only replace the call: categories: Result[0]; And series: Result[1]

  • Ever tried to use Dxchartjs? In it you pass only one datasource with a very simple JSON, hence it already mounts both X and Y.

  • @Renattomachado: I’m using Highcharts in a work of completion and what I saw in Dxchartjs is only 30 days of testing, correct?

  • @Unfortunately the trial version is only 30 days even. You can use the Charjs is very similar to the structure I told you about and is OpenSource! They are only suggestions, the HighCharts is also very good!

  • @Renattomachado is, gets complicated with trial version. Chartjs I used in another project I did, I opted for Highcharts because of the export functionality and its loading speed.

Show 4 more comments

1 answer

1


I’m not sure I really understand what you want in response. If you’re talking about the JSON format, you can do something similar to the below:

{"Result":[["Maio", "Junho", "Julho"], [20, 30, 15]]}

Then when you use:

categories: Result[0];

And

series: Result[1]

Browser other questions tagged

You are not signed in. Login or sign up in order to post.