Home › Forums › Chart Support › Stripline – index label position – adjustments › Reply To: Stripline – index label position – adjustments
@elanchezhiyan,
You can update the position of the scatter datapoints on resizing the window by calculating the width of the index labels and using convertPixeltoValue. Please check the code snippet below:
window.onresize = function() { indexLabelOffset = (chart.width < 700) ? 5 : 2 ; for(var i = 0; i < customLinesData.length; i++) { for(var j = 0; j < scatterDps.length; j++) { if( scatterDps[j].indexLabel === "\u25C0 " + customLinesData[i].label) { indexLabelWidth = getWidth(customLinesData[i].label); scatterDps[j].x = customLinesData[i].x + chart.axisX[0].convertPixelToValue(indexLabelWidth) / 2 + indexLabelOffset; } } } chart.render(); };
Please take a look at this updated JSFiddle for a working example.
— Thangaraj Raman Team CanvasJS