Search code examples
anychart

Anychart: how to combine Jump line and multiseries column chart?


I'm trying to combine a jump line with a multiseries column chart. Is it possible to create a jump line specifically for each column of the multiseries column chart? For now the only thing that i could obtain is a jump line for each group of the dataset, here's an example:

anychart.onDocumentReady(function () {

   var data = [
      ["January", 12000, 10000, 8100],
      ["February", 15000, 12000, 8200],
      ["March", 16000, 18000, 8300],
    ];

    var dataSet = anychart.data.set(data);
    var mapping1 = dataSet.mapAs({x: 0, value: 1});
    var mapping2 = dataSet.mapAs({x: 0, value: 2});
    var jump1 = dataSet.mapAs({x: 0, value: 3});

    // create a chart
    var chart = anychart.column();

    // create the series and set the data
    var series1 = chart.column(mapping1);
    var series2 = chart.column(mapping2);

    var series3 = chart.jumpLine(jump1);
    series3.stroke("3 #FFFF00");

    chart.container("container");
    chart.draw();
});

Solution

  • If I got your idea correctly, then you can create an additional xScale and xAxis. Then bind the jump series to that additional scale. Here is the live sample based on your code.