Home Forums Chart Support markerimage


Viewing 2 posts - 1 through 2 (of 2 total)
  • #33820

    Please How to remove customImage when y axis data is empty .With Empty data customimage not shown in charts.
    please check.



    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)
    		, 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

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.