Search code examples
canvasjs

How to disable expand area for pyramid chart in canvasjs


https://canvasjs.com/javascript-charts/pyramid-chart-area-represents-value/

when I click on pyramid chart then it will be expand, how to disable expand area of pyramid chart.


Solution

  • You need to set explodeOnClick to false to disable exploding of sections in CanvasJS funnel / pyramid chart. Setting interactivityEnabled property to false, as mentioned by user14299292 will remove complete interactivity of chart - doesn't show toolTip aswell. Below is an example.

    var chart = new CanvasJS.Chart("chartContainer", {
      data: [{
      type: "pyramid",
      explodeOnClick: false, //**Change it to true
      dataPoints: [
        {  y: 10, indexLabel:"Research & Design" },
        {  y: 12, indexLabel:"Manufacturing" },
        {  y: 8, indexLabel:"Marketing" },
        {  y: 8, indexLabel: "Shipping" },
        {  y: 15, indexLabel:"Retail" }
      ]
    }]
    });
    
    chart.render();
    <script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
    <div id="chartContainer" style="height: 300px; width: 100%;"></div>