gpt4 book ai didi

javascript - C3 图重叠 x 轴标签

转载 作者:数据小太阳 更新时间:2023-10-29 05:25:09 26 4
gpt4 key购买 nike

C3 图形与日期时间格式的 x 轴标签重叠。我用谷歌搜索了这个查询,但没有得到任何解决方案。c3 是否可能只显示几个日期时间而不是完全显示,这会导致重叠的 x 轴标签 enter image description here

var data = {
x: 'x',
xFormat:'%Y-%m-%d/%H:%M',
empty: {
label: {
text: "No Data"
}
},
columns: [
['x', '{$dateArray}'],
['Attack', {$data}],
],colors: {
Attack: '#67b7dc',
},
types: {
Attack: 'area'
}};
var chart = c3.generate({bindto: '#chart1',
size: {
height: 630,
},
data: data,
grid: {
x: {
show: true
},
y: {
show: true
}
},
tooltip: {
format: {
value: function (value, ratio, id) {
var format = value+' Gbps [ IP: '+destIp[value]+' ]';
return format;
}
}
},
zoom: {
enabled: true
},
subchart: {
show: true
},axis: {
x: {
type: 'timeseries',
tick: {
format: '%b %d, %H:%M',
rotate: 90,
multiline: false
}
},
y: {
tick: {
format: function (d) {
return d.toFixed(3);
}
},
label: {
text: 'Attack Size ( Gbps )',
position: 'outer-middle'
}
}
}
});

最佳答案

使用 c3.js 图表配置 tick.count,将其设置为所需的整数值,如 2,3 或 4。

使用c3.js Timeseries Chart exmaple玩这个配置。

没有 tick.count 的问题:- enter image description here

问题通过 tick.count 配置解决:- enter image description here

关于javascript - C3 图重叠 x 轴标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38697713/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com