Chart.js字母间距非常尴尬 [英] Chart.js letter spacing very awkward
问题描述
如上所示,我的Chart.js中的字母间距很大。我不知道为什么会这样-这是我的配置:
As shown above, the letter spacing in my Chart.js is very large. I have no clue as to why it is that way - here is my config:
var myLineChart = new Chart(ctx, {
type: 'line',
data: lineChartData,
options: {
responsive: true,
scales: {
yAxes: [
{
gridLines: {
color: '#354657',
},
ticks: {
fontFamily: 'Open Sans',
},
},
],
xAxes: [
{
gridLines: {
color: '#354657',
},
ticks: {
fontFamily: 'Open Sans',
},
},
],
},
},
});
无论我使用哪种字体,字母间距都很大。有解决办法吗?
The letter spacing is this large no matter what font I use. Is there a method to reduce it?
推荐答案
不确定您是否已解决此问题,但以为我会给你一个提示。我有一个类似的问题,并将其链接到此问题,对我来说,答案是删除我设置的 devicePixelRatio
设置,但鉴于您在浏览器版本中遇到了问题(我想象),您是否尝试设置 devicePixelRatio = 2
?
Not sure if you've resolved this or not yet, but thought I'd give you a heads up. I had a similar question and linked it to this, the answer for me was removing the devicePixelRatio
setting that I had set, but given you have the problem in the browser version (I imagine), have you tried setting devicePixelRatio = 2
? It might be the fix for this.
这篇关于Chart.js字母间距非常尴尬的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!