2017-11-14 18 views

答えて

2

後にあなたがポイントのスタイルを取得する例です:折れ線グラフのためのポイント・オプションのドキュメントは、以下のコードherehere

A codePenを見つけることができます

HTML:

<html> 
    <body> 
    <div class="myChartDiv"> 
     <canvas id="myChart" width="600" height="400"></canvas> 
    </div> 
    </body> 
</html> 

JS:

new Chart(document.getElementById("myChart"), { 
    type: "line", 
    data: { 
    labels: ["January", "February", "March", "April", "May", "June"], 
    datasets: [ 
     { 
     label: "My First Dataset", 
     data: [20, 25, 22, 19, 31, 40], 
     fill: true, 
     borderColor: "rgb(75, 192, 192)", 
     backgroundColor: "rgba(0,0,0,0.1)", 
     borderWidth: 2, 
     lineTension: 0, 
     /* point options */ 
     pointBorderColor: "blue", // blue point border 
     pointBackgroundColor: "white", // wite point fill 
     pointBorderWidth: 1, // point border width 
     } 
    ] 
    }, 
    options: { 
    legend: { 
     labels: { 
     usePointStyle: true, // show legend as point instead of box 
     fontSize: 10 // legend point size is based on fontsize 
     } 
    } 
    } 
}); 
関連する問題