[英]how to label the x and y axis - in a line graph
I'm using js and chart.js
, I'm trying to label my x & y axis and no matter which example I try nothing works, in my code a few examples 1. change using labels
, 2, change using label
inside the axes
.. How to name my x and y ? 我正在使用js和
chart.js
,我正在尝试标记我的x和y轴,无论哪个示例我都没有尝试,在我的代码中有几个示例1.使用labels
更改,2,使用label
更改axes
..如何命名我的x和y?
var vtx = document.getElementById("nowChart").getContext("2d");
var myChart = new Chart(vtx, {
type: 'line',
labels: [{ xLabels: "Days" }, {yLabels:"Ways"} ],
data: {
datasets: [{
label: 'IBM graph',
data: mydata,
showLine: true,
pointBackgroundColor: "#00ff11",
pointBorderWidth: 1,
}]
},
options: {
scales: {
xAxes: [{
type: 'linear',
position: 'bottom',
ticks: {
beginAtZero: true
},
label:"Days"
}],
yAxes: [{
type: 'linear',
position: 'left',
stacked: true,
ticks: {
beginAtZero: true
},
label: "Rays"
}]
}
}
});
Your config looks wrong. 您的配置看起来不对。 Take a look at the chart.js line graph sample to see how to correctly do this.
看一下chart.js 折线图示例 ,看看如何正确执行此操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.