我试图在 x 和 y 轴上显示带有所需选项的以下图表,但轴上的更改不起作用。正在显示图表,但 Y 轴没有 min、max 属性,position 不是我传递的那个...有什么问题吗?
<div id="chart2"></div>
<script>
var chart = c3.generate({
bindto: '#chart2',
data: {
url: "../static/CSV/Chart_data/grades_access.csv",
x:'AC_GRADE',
type: 'scatter'
},
axis: {
y: {
label: "Average grade",
position: "outer-middle",
padding: {top: 200, bottom: 0},
min:0,
max:10
},
x: {
label: "Access grade",
position: "outer-center",
padding: {top: 200, bottom: 0},
min:0,
max:10
}
},
size: {
height: 400,
width: 800
},
zoom: {
enabled: true
}
});
</script>
最佳答案
嗯,实际上有很多错误定义的参数。
1.标签位置应该这样定义
axis: {
x: {
label: {
text: 'Your X Axis',
position: 'outer-center'
}
}
}
2. 填充会影响最小值和最大值,因此您应该根据需要将其设置为 0
。
3.x
轴的填充应使用left
和right
属性。
也许还有别的,只需检查 http://c3js.org/reference.html彻底。
关于javascript - c3 图表不显示轴上的变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50220461/