下面是 c3 图表代码片段。我要求 x 轴上的条形标签为“总增益”。但我无法明白这一点,只允许没有空格的单个单词,例如“Totalgain”。请参阅下面的评论。
c3.generate({
data: {
columns: Figurefour,
groups: [
['Trending', 'Total gain']
],
colors: {
Trending: '#33fefe',
Total gain : '#22cfcf'//"Total gain" errors out, only single word(s) like "Totalgain" allowed(no spaces).
}
}
});
有没有办法让带有空格的标签起作用?
最佳答案
只需在其周围加上引号,就像这样
...
"Total gain" : '#22cfcf'
}
...
关于javascript - 如何在 Javascript c3 图表中添加带间距的标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32584030/