Home Forums Chart Support Draw line between StripLines Reply To: Draw line between StripLines

#37774

@ragu1991nathan,

You can add a dummy line dataSeries with x-values based on stripLines values and use indexLabel to show the length between the stripLines. Please find the code snippet for the same below.

chart.addTo("data", {
    type: "line",
    toolTipContent: null,
    highlightEnabled: false,
    markerSize: 0,
    dataPoints: [
      { x: striplines[0].get("value"), y: (chart.axisY[0].viewportMaximum + chart.axisY[0].viewportMinimum) / 2 },
      { x: (striplines[1].get("value") + striplines[0].get("value")) / 2, y: (chart.axisY[0].viewportMaximum - chart.axisY[0].viewportMinimum) / 2, indexLabel:  (striplines[1].get("value") - striplines[0].get("value")).toString()},
      { x: striplines[1].get("value"), y: (chart.axisY[0].viewportMaximum - chart.axisY[0].viewportMinimum) / 2 }
    ]
});

Please check this JSFiddle for a working example.


Thangaraj Raman
Team CanvasJS