Home Forums Chart Support Marker image on multiple datapoints with multiple lines Reply To: Marker image on multiple datapoints with multiple lines

#36852

@elanchezhiyan,

You can position the image relative to viewport of the chart using rangeChanged event that would trigger whenever the chart range is changed by zooming/panning. Please find the code-snippet below.

 if(chart.data[dsIndex].dataPoints[dpIndex].x > chart.axisX[0].viewportMinimum && chart.data[dsIndex].dataPoints[dpIndex].x < chart.axisX[0].viewportMaximum) {
    customMarker.css({display: "block"})
  }
  else {
    customMarker.css({display: "none"})
  }

Also, take a look at this JSFiddle for complete working sample.

—-
Ranjitha R
Team CanvasJS