Home Forums Chart Support markerimage Reply To: markerimage

#33829

@ashu-sharma,

You can have a condition check before pushing image in addMarkerImages1 method to avoid adding image when datapoint y-value is empty string. Please find the code-snippet below.

function addMarkerImages1(chart1) {
  for (var i = 0; i < chart1.data[1].dataPoints.length; i++) {
	if(chart1.data[1].dataPoints[i].y != ""){
		Markers.push({image: $("<img>").attr("src",chart1.data[1].dataPoints[i].ImageUrl)
		  .css("display", "none")
		  .css("height", 20)
		  .css("width", 20)
		  .appendTo($("#chartContainer1>.canvasjs-chart-container"))
		, dataPointIndex: i});
	}
  }
  for(var i = 0; i < Markers.length; i++)
	positionMarkerImage1(Markers[i].image, Markers[i].dataPointIndex);
}

Please take a look at this JSFiddle for complete code.

If you are still facing issue, kindly create JSFiddle reproducing the issue you are facing & share it with us so that we can run the code at our end, debug to understand the scenario & help you resolve.


Vishwas R
Team CanvasJS