如何在 canvasjs 中禁用金字塔图的扩展区域

How to disable expand area for pyramid chart in canvasjs

当我点击金字塔图表时它会展开,如何禁用金字塔图表的展开区域。

试试这个

var  chart =  new  CanvasJS.Chart("container",
{
 .
 .
 interactivityEnabled: false,
 .
 .
});
chart.render();

您需要设置 explodeOnClick to false to disable exploding of sections in CanvasJS funnel / pyramid chart. Setting interactivityEnabled property to false, as mentioned by 将删除图表的完整交互性 - 也不显示工具提示。下面是一个例子。

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>