[英]Charts.js : How to remove the Vertical Black lines in Bar Chart
如何刪除在條形圖中顯示在條形兩側的垂直黑線?
我都試過了
options : {
scaleShowVerticalLines: false
}
options : {
scales : {
xAxes : [ {
gridLines : {
display : false
}
} ]
}
}
這是我的代碼行:
//Chart Axis's
let scales = {
xAxes: [{
gridLines: { display: false },
ticks: {
font: {
size: config.size,
},
color: "white",
},
}],
yAxes: [{
ticks: {
beginAtZero:true
},
}]
};
let ctx = document.getElementById('how_i_spend_canvas');
if (ctx) { // DOM element is present and not null
let categoriesChart = new Chart(ctx.getContext('2d'), {
type: 'bar',
data: howISpendChartdata,
// Chart pulgins & Options
plugins: [ChartDataLabels],
options: {
scales: scales,
responsive: true,
maintainAspectRatio: false,
aspectRatio: 2,
plugins: plugins,
}
}
onClick: function (evt, element) {}
但我對我不起作用。
參考箭頭指向線條的位置。
現在得到了答案,就像在 Chart JS 3 中一樣,它們已更改為grid而不是常見的gridlines命令。
現在在圖表 JS 3 中可以使用:
x: {
grid:{
color:'red',
display: false,
}
},
y:{
ticks: {
beginAtZero: true
},
grid: {
color: 'green',
display: true,
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.