show two different series with different start intervals with the same xAxis highcharts -


http://jsbin.com/enotab/39/editi want show data 2 different years on same xaxis without using 2 x axes. in case following result

i want have overlay graph 2 series 2012 series becomes shadow graph. how possible? static code:

var mychart = new highcharts.chart({     chart: {         renderto: 'container',         zoomtype: 'x'     },     title: {         text: 'chart title'     },     xaxis: [{         type: 'datetime',         minrange: 31 * 24 * 3600000,         labels: {             formatter: function () {                 return highcharts.dateformat('%e %b %y', this.value);             }         }     }],  yaxis: {     title: {         text: 'current values'     },     gridlinecolor: 'transparent',     plotlines: [{         value: 0,         color: 'green',         dashstyle: 'longdashdot',         width: 1     }, {         value: 30,         color: 'orange',         dashstyle: 'longdashdot',         width: 1     }, {         value: 60,         color: 'red',         dashstyle: 'longdashdot',         width: 1     }, {         value: 80,         color: 'black',         dashstyle: 'longdashdot',         width: 1     }] },  tooltip: {     crosshairs: true,     shared: true },  plotoptions: {     series: {         fillcolor: {             lineargradient: {                 x1: 0,                 y1: 0,                 x2: 0,                 y2: 1             },             stops: [                 [0, highcharts.getoptions().colors[0]],                 [1, 'rgba(0,0,0,0.1)']             ]         },         linewidth: 1,         shadow: false,         marker: {             enabled: false,             states: {                 hover: {                     enabled: true,                     radius: 5,                     fillcolor: 'red'                 }             }         },         states: {             hover: {                 linewidth: 1             }         },         threshold: null     } //area }, //plotoptions  series: [{     type: 'area',     //color:'#89a54e',     color: '#4572a7',     linewidth: 0.1,     name: '2012',  //   xaxis: 0,     zindex: -1,     pointinterval: 24 * 3600 * 1000,     pointstart: date.utc(2013, 0, 1),     data: [         [date.utc(2013, 0, 1), 3],         [date.utc(2013, 0, 2), 12],         [date.utc(2013, 0, 3), 30],         [date.utc(2013, 0, 4), 22],         [date.utc(2013, 0, 5), 12],         [date.utc(2013, 0, 8), 13],         [date.utc(2013, 0, 9), 12],         [date.utc(2013, 0, 11), 13],         [date.utc(2013, 0, 12), 22],         [date.utc(2013, 0, 15), 1],         [date.utc(2013, 0, 16), 25],         [date.utc(2013, 0, 18), 43],         [date.utc(2013, 0, 19), 26],         [date.utc(2013, 0, 20), 23],         [date.utc(2013, 0, 21), 12],         [date.utc(2013, 0, 22), 13],         [date.utc(2013, 0, 23), 22],         [date.utc(2013, 0, 24), 1],         [date.utc(2013, 0, 25), 25],         [date.utc(2013, 0, 26), 43],         [date.utc(2013, 0, 27), 26],         [date.utc(2013, 0, 28), 23],          [date.utc(2013, 0, 29), 12],         [date.utc(2013, 0, 30), 13],         [date.utc(2013, 0, 31), 22],         [date.utc(2013, 1, 1), 1],         [date.utc(2013, 1, 2), -5],         [date.utc(2013, 1, 3), 43],         [date.utc(2013, 1, 4), 26],         [date.utc(2013, 1, 5), 23],         [date.utc(2013, 1, 6), 25],         [date.utc(2013, 1, 7), 43],         [date.utc(2013, 1, 8), 26],         [date.utc(2013, 1, 9), 23],         [date.utc(2013, 1, 10), 35],         [date.utc(2013, 1, 11), 38],         [date.utc(2013, 1, 14), 36],         [date.utc(2013, 1, 15), 3],         [date.utc(2013, 1, 16), 55],         [date.utc(2013, 1, 17), 43],         [date.utc(2013, 1, 18), 22],         [date.utc(2013, 1, 19), -3]     ]  }, {     type: 'line',     name: '2013',     color: '#89a54e',     linewidth: 3,     zindex: 3,     //  xaxis:1,     pointinterval: 24 * 3600 * 1000,     pointstart: date.utc(2012, 0, 1),     data: [         [date.utc(2012, 0, 1), 13],         [date.utc(2012, 0, 2), 52],         [date.utc(2012, 0, 3), 3],         [date.utc(2012, 0, 4), 12],         [date.utc(2012, 0, 5), 2],         [date.utc(2012, 0, 6), 35],         [date.utc(2012, 0, 7), 12],         [date.utc(2012, 0, 8), 35],         [date.utc(2012, 0, 9), 22],         [date.utc(2012, 0, 11), 3],         [date.utc(2012, 0, 12), 32],         [date.utc(2012, 0, 15), 41],         [date.utc(2012, 0, 16), 45],         [date.utc(2012, 0, 18), 63],         [date.utc(2012, 0, 19), 16],         [date.utc(2012, 0, 20), 83],         [date.utc(2012, 0, 21), 1],         [date.utc(2012, 0, 22), 75],         [date.utc(2012, 0, 23), 52],         [date.utc(2012, 0, 24), 1],         [date.utc(2012, 0, 25), 65],         [date.utc(2012, 0, 26), 13],         [date.utc(2012, 0, 27), 76],         [date.utc(2012, 0, 28), 56],          [date.utc(2012, 0, 29), 12],         [date.utc(2012, 0, 30), 13],         [date.utc(2012, 0, 31), 22],         [date.utc(2012, 1, 1), 1],         [date.utc(2012, 1, 2), 25],         [date.utc(2012, 1, 3), 43],         [date.utc(2012, 1, 4), 26],         [date.utc(2012, 1, 5), 23],         [date.utc(2012, 1, 6), 25],         [date.utc(2012, 1, 7), 43],         [date.utc(2012, 1, 8), 26],         [date.utc(2012, 1, 9), 23],         [date.utc(2012, 1, 10), 35],         [date.utc(2012, 1, 11), 48],         [date.utc(2012, 1, 14), 86],         [date.utc(2012, 1, 15), 73],         [date.utc(2012, 1, 16), 55],         [date.utc(2012, 1, 17), 43],         [date.utc(2012, 1, 18), 22],         [date.utc(2012, 1, 19), -3]     ] }] }); }); 

it depends on want shown on x axis. if want keep first axis labels, remove labels second x axis , offset on first:

xaxis:[ {type: 'datetime', minrange:31*24 *3600000 , offset:10,          labels: {formatter: function() {return highcharts.dateformat('%e %b', this.value);         }     } },     {type: 'datetime', minrange:31*24 *3600000 , offset:10,        labels: {enabled:false}     }], 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -