Zing Chart的Crosshair功能是泄漏CPU

时间:2017-04-27 03:29:26

标签: javascript angular zingchart

当我在我的图表中启用十字准线功能时,Chrome 56中的一切正常,但当我将Chrome升级到57(现在甚至是chrome 58和ZingChart 2.6.0)时,当鼠标悬停时,CPU使用率始终高于25%图表,如看十字准线。当我有2个图表时,CPU使用率上升到99%,浏览器减速并很快崩溃。

我尝试禁用所有功能以查看此问题的原因,当我禁用十字准线时,CPU使用率再次正常。如果我禁用除十字准线功能以外的所有功能,则会观察到相同的CPU占用效果。

释放资源的唯一方法是终止标签。

这是我的代码:

var dataChart = {
  id: "ShSDbePYhAxC",
  data: {
    type: "area",
    "crosshair-x": {
      "plot-label": {
        text: "The %t Series has a value of %v."
      }
    },
    gui: {
      behaviors: [
        {
          id: "Reload",
          enabled: "none"
        }
      ],
      contextMenu: {
        customItems: [
          {
            function: "zingAlert()",
            id: "zingAlert",
            text: "zing Alert"
          }
        ]
      }
    },
    item: {
      angle: -30
    },
    legend: {
      "background-color": "white",
      "border-color": "black",
      "border-radius": "5px",
      "border-width": 2,
      layout: "1xauto",
      padding: "10%",
      x: "12%",
      y: "90%"
    },
    plot: {
      alphaArea: 1,
      aspect: "spline",
      "bar-width": "15px",
      "contour-on-top": false,
      lineWidth: "2px",
      stacked: true,
      marker: {
        visible: false
      },
      tooltip: {
        visible: false
      }
    },
    plotarea: {
      "margin-bottom": "23%",
      "margin-left": "dynamic"
    },
    "scale-x": {
      item: {
        angle: -30
      },
      labels: [
        "Name0", "Name1", "Name2", "Name3", "Name4"
      ]
    },
    "scale-y": {
      label: {
        "font-size": "15%",
        text: "Number Of Visitors"
      }
    },
    series: [
      {
        text: "Text A",
        values: [11111, 222222, 3333333, 444444, 55555]
      },
      {
        text: "Text B",
        values: [6666, 777777, 88888, 99999, 12121212]
      }
    ]
  },
  height: 550,
  output: "canvas",
  width: "100%",
}

1 个答案:

答案 0 :(得分:1)

所以我们一直倾向于相信这可能是一个问题和角色问题。要确认这一点,您可以将zingchart版本恢复为旧版本,如v2.2.2。您可以通过以下链接的cdn访问此版本

根目录: http://cdn.zingchart.com/2.2.2/

ZingChart.min: http://cdn.zingchart.com/2.2.2/zingchart.min.js

模块: http://cdn.zingchart.com/2.2.2/modules/

如果问题仍然发生在浏览器和Angular问题上,我们知道应该把重点放在哪里。如果问题消失,那就直接导致了ZingChart问题。