【问题标题】:ChartJs - pie chart not showingChartJs - 饼图未显示
【发布时间】:2016-07-05 07:09:44
【问题描述】:

尝试创建一个简单的饼图:https://jsfiddle.net/omriman12/px2mbnse/1/

我的 HTML:

<canvas id="myChart" width="400" height="400"></canvas>

我的 JS:

var ctx = document.getElementById("myChart").getContext("2d");

var myChart = new Chart(ctx, {
  type: 'pie',
  data: {
    labels: [
      "a",
      "b",
    ],
    datasets: [{
      data: [10, 20],
      backgroundColor: [
        "#DA1A32",
        "#F0FFFF"
      ],
      borderWidth: false,
      borderColor: false
    }]
  },
  options: {
    cutoutPercentage: 0.9
  }
});

我错过了什么。

【问题讨论】:

    标签: javascript chart.js


    【解决方案1】:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多