Highcharts display date as series label from JSON data? -
i have data can either weekly or monthly gets returned json.
can explain how can return series in payload group each series? is, display x-axis label?
i want use 1 chart display (weekly, monthly, daily) json data payload use 1 chart display json payload either time slice.
for example:
weekly payload:
[ { "date-label":"week 24", "series1":789118, "series2":49475, }, { "date-label":"week 25", "series1":5759546, "series2":286657, } ]
monthly payload:
[ { "date-label":"june", "series1":789118, "series2":49475, }, { "date-label":"july", "series1":5759546, "series2":286657, } ]
how many points have?
if there couple (~10?) can use categories, , result should be:
new highcharts.chart({ xaxis: { categories: ['june', 'july' ... ] }, series: [{ data: [123, 124 ...] }, { data: [123, 124 ...] }] });
if have more points, wouldn't possible display categories, need change format 'week 24' or 'june' timestamp, this:
new highcharts.chart({ xaxis: { type: 'datetime' }, series: [{ data: [[timestamp, 123], [timestamp, 124] ...] }, { data: [[timestamp, 123], [timestamp, 124] ...] }] });
where timestamp in milliseconds.
Comments
Post a Comment