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



You can retain the viewportMinimum and viewportMaximum for both axisX and axisY before hiding all the dataseries (by setting visible of each dataseries to false). Please find the code snippet for the same below.

document.getElementById("hide").addEventListener("click", function(){
    for(var i = 0; i < chart.options.data.length; i++) {
      chart.options.data[i].showInLegend = false;
      chart.options.data[i].visible = false;
    chart.axisX[0].set("viewportMinimum", chart.axisX[0].get("viewportMinimum"), false);
    chart.axisX[0].set("viewportMaximum", chart.axisX[0].get("viewportMaximum"), false);
    chart.axisY[0].set("viewportMinimum", chart.axisY[0].get("viewportMinimum"), false);
    chart.axisY[0].set("viewportMaximum", chart.axisY[0].get("viewportMaximum"), false);

Please take a look at this updated JSFiddle for complete code.

Thangaraj Raman
Team CanvasJS