首页 \ 问答 \ 安卓手机软件开发

安卓手机软件开发

哪里有安卓手机软件开发的软件培训学校?我想找好一点的
更新时间:2022-02-25 12:02

最满意答案

我改变了你的数据结构。 有了这个新的“数据”,代码就可以了。 我认为您使用了特定的数据结构来绘制折线图。

<html>
  <head>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.js"></script>
  </head>

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


    <script>
      // Get the context of the canvas element we want to select

var data = [
    {
        value: 300,
        color:"#F7464A",
        highlight: "#FF5A5E",
        label: "Red"
    },
    {
        value: 50,
        color: "#46BFBD",
        highlight: "#5AD3D1",
        label: "Green"
    },
    {
        value: 100,
        color: "#FDB45C",
        highlight: "#FFC870",
        label: "Yellow"
    },
    {
        value: 40,
        color: "#949FB1",
        highlight: "#A8B3C5",
        label: "Grey"
    },
    {
        value: 120,
        color: "#4D5360",
        highlight: "#616774",
        label: "Dark Grey"
    }

];

var ctx = document.getElementById("myChart").getContext("2d");
var myNewChart = new Chart(ctx).PolarArea(data);

    </script>
  </body>

</html>

I changed your data structure. With this new "data", the code works. I think that you used a specific data structure for line chart.

<html>
  <head>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.js"></script>
  </head>

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


    <script>
      // Get the context of the canvas element we want to select

var data = [
    {
        value: 300,
        color:"#F7464A",
        highlight: "#FF5A5E",
        label: "Red"
    },
    {
        value: 50,
        color: "#46BFBD",
        highlight: "#5AD3D1",
        label: "Green"
    },
    {
        value: 100,
        color: "#FDB45C",
        highlight: "#FFC870",
        label: "Yellow"
    },
    {
        value: 40,
        color: "#949FB1",
        highlight: "#A8B3C5",
        label: "Grey"
    },
    {
        value: 120,
        color: "#4D5360",
        highlight: "#616774",
        label: "Dark Grey"
    }

];

var ctx = document.getElementById("myChart").getContext("2d");
var myNewChart = new Chart(ctx).PolarArea(data);

    </script>
  </body>

</html>

相关问答

更多
  • 我改变了你的数据结构。 有了这个新的“数据”,代码就可以了。 我认为您使用了特定的数据结构来绘制折线图。