Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highcharts - graph - decades

I want to draw a pretty special graph in Highcharts (javascript library). I want the x-axis to have the decades from 1890 to 2010, but the graph data-can be in between these decades (for example 1891 or 1974). Does anyone know how to do this? Or can point me in the right direction.

like image 793
OptimusCrime Avatar asked Feb 21 '26 12:02

OptimusCrime


1 Answers

Using min and max together with tickInterval and minorTickInterval will do the work.

// Start at 1890
min: Date.UTC(1890, 0, 1),

// End at 2010
max: Date.UTC(2010, 0, 1),

// Tick interval of 10 years
tickInterval: Date.UTC(2010, 0, 1) - Date.UTC(2000, 0, 1),

// Minor tick interval of 2
minorTickInterval: Date.UTC(2010, 0, 1) - Date.UTC(2008, 0, 1)

Example on jsfiddle enter image description here

like image 77
eolsson Avatar answered Feb 23 '26 02:02

eolsson