jQuery HighCharts: DateTime X Axis Data label issues -
i have bunch of monthly datetime based data points need map in line chart. trying accomplish:
- i need points plotted on chart
- i need line charts of 3 series begin on first data point @ bottom left (january 1st).
- the first data point needs display text phrase , rest need remain formatted date.
please take @ jsfiddle. http://jsfiddle.net/fwgdw/7/
$(function () { $('#container').highcharts({ chart: { type: 'spline' }, title: { text: 'performance chart' }, subtitle: { text: 'monthly date inverval' }, xaxis: { type: 'datetime', datetimelabelformats: { month: '%b-%y', year: '%b-%y'}, /*showfirstlabel: false, startontick: true*/ }, yaxis: { min: 0 }, tooltip: { headerformat: '<b>{series.name}</b><br>', pointformat: '{point.x:%e. %b}: {point.y:.2f} m'}, series: [{ name: '1st series', data: [ [date.utc(2013, 0, 31), 0], [date.utc(2013, 1, 28), 0.6], [date.utc(2013, 2, 31), 1.7], [date.utc(2013, 3, 30), 2.8], [date.utc(2013, 4, 31), 0.6], [date.utc(2013, 5, 30), 3.6], [date.utc(2013, 6, 31), 3.6], [date.utc(2013, 7, 31), 2.81], [date.utc(2013, 8, 30), 0.78], [date.utc(2013, 9, 31), 0.98], [date.utc(2013, 10, 30), 1.84], [date.utc(2013, 11, 31), 1.80], [date.utc(2014, 0, 31), 0], [date.utc(2014, 1, 28), 0.6], [date.utc(2014, 2, 31), 0.7], [date.utc(2014, 3, 30), 0.8], [date.utc(2014, 4, 31), 0.6], [date.utc(2014, 5, 30), 0.6], [date.utc(2014, 6, 31), 0.6], [date.utc(2014, 7, 31), 0.81], [date.utc(2014, 8, 30), 0.78], [date.utc(2014, 9, 31), 0.98], [date.utc(2014, 10, 30), 1.84], [date.utc(2014, 11, 31), 1.80] ] }, { name: '2nd series', data: [ [date.utc(2013, 0, 31), 1], [date.utc(2013, 1, 28), 3.6], [date.utc(2013, 2, 31), 2.2], [date.utc(2013, 3, 30), 4.2], [date.utc(2013, 4, 31), 4.6], [date.utc(2013, 5, 30), 5.6], [date.utc(2013, 6, 31), 0.6], [date.utc(2013, 7, 31), 0.21], [date.utc(2013, 8, 30), 2.78], [date.utc(2013, 9, 31), 0.98], [date.utc(2013, 10, 30), 2.84], [date.utc(2013, 11, 31), 1.80], [date.utc(2014, 0, 31), 4], [date.utc(2014, 1, 28), 3.6], [date.utc(2014, 2, 31), 5.7], [date.utc(2014, 3, 30), 4.8], [date.utc(2014, 4, 31), 2.6], [date.utc(2014, 5, 30), 0.1], [date.utc(2014, 6, 31), 0.9], [date.utc(2014, 7, 31), 0.81], [date.utc(2014, 8, 30), 3.78], [date.utc(2014, 9, 31), 0.98], [date.utc(2014, 10, 30), 1.84], [date.utc(2014, 11, 31), 1.80] ] }, { name: '3rd series', data: [ [date.utc(2013, 0, 31), 0], [date.utc(2013, 1, 28), 0.6], [date.utc(2013, 2, 31), 0.7], [date.utc(2013, 3, 30), 0.8], [date.utc(2013, 4, 31), 0.6], [date.utc(2013, 5, 30), 0.6], [date.utc(2013, 6, 31), 0.6], [date.utc(2013, 7, 31), 1.81], [date.utc(2013, 8, 30), 7.78], [date.utc(2013, 9, 31), 7.98], [date.utc(2013, 10, 30), 1.2], [date.utc(2013, 11, 31), 1.80], [date.utc(2014, 0, 31), 0], [date.utc(2014, 1, 28), 0.6], [date.utc(2014, 2, 31), 2.2], [date.utc(2014, 3, 30), 4.8], [date.utc(2014, 4, 31), 0.6], [date.utc(2014, 5, 30), 0.6], [date.utc(2014, 6, 31), 2.6], [date.utc(2014, 7, 31), 1.81], [date.utc(2014, 8, 30), 1.78], [date.utc(2014, 9, 31), 3.98], [date.utc(2014, 10, 30), 2.84], [date.utc(2014, 11, 31), 1.80] ] }] }); });
- the x axis labels not map actual data points. seem 1 month off.
- i need first data label on displayed , starting @ april not january. need first x axis label specific phrase , not formatted 31.jan date value.
- the final x axis data label jan-2015 not data point in series.
okay, here are:
the x axis labels not map actual data points. seem 1 month off.
they fine, consider first point: date.utc(2013, 0, 31)
-> it's 31st of january. axis' labels displayed @ 1st of month.
i need first data label on displayed , starting @ april not january.
create own tickpositioner.
i need first x axis label specific phrase , not formatted 31.jan date value.
use labels.formatter. use this.isfirst
determine first label.
the final x axis data label jan-2015 not data point in series.
set maxpadding = 0.
Comments
Post a Comment