我有一个简单的 c3js 折线图,有 3 条不同的线。当我“取消选择”所有 3 个数据源时,x 轴刻度值消失。我想知道是否有办法扭转这种行为?即使没有数据,我也想显示 x 轴刻度值。
xaxis 刻度值是“时间序列”类型。谢谢!
这是我的折线图的 c3 配置:
bindto: '#test',
data: {
x: 'date',
xFormat: '%m%d',
columns: [],
},
legend: {
position: 'bottom',
},
axis: {
y: {
tick: {
format: function (d) { return d + '%'; },
count: 5,
},
max: 100,
padding: {
top: 0,
bottom: 0,
},
},
x: {
type: 'timeseries',
tick: {
culling: false,
},
},
},
color: {
pattern: [testRateColor, firstRateColor, secRateColor],
},
最佳答案
不幸的是,此功能已融入 c3.js 中,并且更改此功能的唯一方法(除了纯粹从 d3 工作之外)是猴子修补。你会在c3.js的第6814行找到罪犯:
tickExit = tick.exit().remove(),
如果您将其更改为:
tickExit = function() {},
蜱虫不再被移除。
关于javascript - c3js折线图所有未选择的数据如何显示刻度值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30310441/