this.options = {
chart: {
type: 'linePlusBarChart',
height: 500,
margin: {
top: 30,
right: 75,
bottom: 50,
left: 75
},
bars: {
forceY: [0]
},
bars2: {
forceY: [0]
},
color: ['#2ca02c', 'darkred'],
x: function(d, i) { return i; },
xAxis: {
axisLabel: 'X Axis',
tickFormat: (d) => {
let dx = this.data[0].values[d] && this.data[0].values[d].x || 0;
return dx;
}
},
x2Axis: {
tickFormat: (d) => {
let dx = this.data[0].values[d] && this.data[0].values[d].x || 0;
return dx;
},
showMaxMin: false
},
y1Axis: {
axisLabel: 'Y1 Axis',
tickFormat: function(d){
return d3.format(',f')(d);
},
axisLabelDistance: 12
},
y2Axis: {
axisLabel: 'TargetLine Axis',
rotateLabels: -35,
}
}
};我想显式地设置y1Axis范围,比如1到100。我该怎么做呢?
在d3的文档中,我找到了tickValues,但我不确定如何在上面的配置对象中使用此方法。
提前感谢您的任何帮助。
发布于 2016-10-25 02:08:23
找到答案了。如果以后有人需要的话,只是为了进一步的参考。
lines: {
// for line chart
forceY: [0, 100]
},不需要更改y1Axis,因为它是由行使用的。因此,如果我们强制line遵循y轴的任何准则,它就能做到这一点。
https://stackoverflow.com/questions/40223325
复制相似问题