【发布时间】:2017-11-29 03:36:27
【问题描述】:
我正在使用 Chart JS 2.6.0。我为带有白色标签的图表使用蓝色背景。但是,当图表在屏幕上呈现时,标签上有一个黑色边框,如下所示:
有没有办法摆脱这个边框,或者我是否可以设置边框本身的样式并以某种方式使其透明或白色?
更新:
添加代码以供参考。我在 xAxes 和 yAxes 的“刻度”对象中设置字体颜色和大小:
const TYPE = 'horizontalBar';
let data = {
labels: ['National', 'Banner Groups'],
datasets: [{
backgroundColor: '#fff',
data: [10, 20]
}]
};
let options = {
showDatapoints: true,
scales: {
maintainAspectRatio: false,
responsive: true,
xAxes: [{
ticks: {
fontColor: '#fff',
fontSize: 15,
beginAtZero: true
},
gridLines: {
display: false
}
}],
yAxes: [{
ticks: {
fontColor: '#fff',
fontSize: 15,
fontStyle: 'bold'
},
gridLines: {
display: false
}
}]
},
legend: {
display: false
}
};
let cf: any = {
type: TYPE,
data: data,
options: options
};
【问题讨论】:
-
jsfiddle.net/j6nqt4oo 如果图表调整大小并变大,则没有问题。但是,如果我们缩小尺寸,问题就会出现。
标签: html5-canvas chart.js