Jump to content
JChartFX Community
  • 0

jchartfx getting a particular data


heena

Question

hello all,

I have a variable containing json data as var data = [
            { "Month": "Jan", "Bikes": 1800, "Parts": 1300 },
            { "Month": "Feb", "Bikes": 1760, "Parts": 900 },
            { "Month": "Mar", "Bikes": 1740, "Parts": 970 },
            { "Month": "Apr", "Bikes": 1750, "Parts": 1010},
            { "Month": "May", "Bikes": 1810, "Parts": 1070 },
            { "Month": "Jun", "Bikes": 1920, "Parts": 1180 }
            ];

I want to get the value in the month field ,but each time I call  var month= chart1.getData().getItem(0,0); I get the value as 1800 . please help me with this. 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

getData().getItem(series, point) will return the numerical data for the specified series/point combination. The first string in your json objects will be used as the X axis labels which you can retrieve as follows

chart1.getAxisX().getLabels().getItem(point)

Obviously if you keep a reference to the data that you passed to the chart using setDataSource you could do this

var data = [...];

chart1.setDataSource(data);

... 

data[index].Month 

JuanC 

post-2107-13939743544002_thumb.gif

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...