Search code examples
javascriptchartstooltipcanvasjs

Disable tooltip in CanvasJS Combination Chart


Is it possible to disable tooltips for only one series in a combination chart of canvasjs below?

  data: [
  {
      type: "area",
      color: "red",        // change color here
      fillOpacity: 1,
      dataPoints: [
    { x: 0, y: 100 },
    { x: 100, y: 100 }
    ]
  },
    {
        type: "area",
        color: "yellow",
        toolTipContent: " ",
        dataPoints: [
    { x: 0, y: 10 },
    { x: 100, y: 100 }
    ]
    }
 ]

Here is the link to my fiddle : https://jsfiddle.net/Abhishek1191/s71djz9m/2

I have four separate series plotted inside the fiddle. 3 Area and 1 line. If anyone may let me know if I can disable tooltips for area series.

Thanks in advance


Solution

  • Instead of setting toolTipContent to empty string, set toolTipContent to null which will disable the toolTip for individual dataPoint / dataSeries. In your jsfiddle you are using v1.4.1 which does not support this feature. Please download the latest version. Here is the working code .

    var  chart =  new  CanvasJS.Chart("container",
    {
        data: [
        {
            toolTipContent: null,
            type: "column",
            dataPoints:[
                { x: 10, y: 20}
            ]
        }
        ]
    });
    chart.render();