javascript - Formatting the year in highcharts -
i'm pulling data django templates highcharts series. have year x-axis , rating y-axis, displays year decimal,such year "1998" displayed "1,998". want year displayed without comma.
here code axis , series:
xaxis: { title: { type: 'datetime', text: 'year', } }, yaxis: { title: { text: 'rating' } }, series: [{ data: [ {% item in graph_data %} { name: '{{item}}', x: {{item.year}}, y: {{item.rating}} }, {% endfor %} ] }]
if used array of date time x , y data points in series, need use date.utc() convert time universal time first. , type
property isn't inside title
property.
so try this
xaxis: { title: { text: 'year', } type: 'datetime' }, yaxis: { title: { text: 'rating' } }, series: [{ data: [ {% item in graph_data %} { name: '{{item}}', x: date.utc({{item.year}}, month, date), y: {{item.rating}} }, {% endfor %} ] }]
fiddle: http://jsfiddle.net/6abdq/1/
Comments
Post a Comment