
如果你看看那些红色的圈区域,你可以看到轴在左下角溢出,在Y轴的顶部和X轴的末端有轴的滴答声。
我为axis和c3图表配置提供的唯一自定义CSS:
.tick line {
display: none;
}
var rateConfig = {
bindto: '#line-chart',
data: {
x: 'date',
xFormat: '%m%d',
columns: [],
},
legend: {
show: false,
},
point: {
r: 4,
},
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: [colors['Rate1'], colors['Rate2'], colors['Rate3']],
},
grid: {
y: {
lines: [
{value: 25},
{value: 50},
{value: 75},
{value: 100},
],
},
},发布于 2015-05-19 22:21:12
看一看这个:
http://c3js.org/reference.html#axis-x-tick-outer
您只需要像这样修改对rateConfig的调用:
....
axis: {
y: {
tick: {
format: function (d) { return d + '%'; },
count: 5,
outer: false
},
max: 100,
padding: {
top: 0,
bottom: 0
}
},
x: {
type: 'timeseries',
tick: {
culling: false,
outer: false
}
}
},
....注意,在x和y标记中都添加了outer: false。
https://stackoverflow.com/questions/30335789
复制相似问题