折柱混搭图,多个Y轴 0坐标点不对齐。求大神解决,急急急!
echarts吧
全部回复
仅看楼主
level 1
无敌小猪z 楼主
如图,当有负值的时候,3个Y轴的0坐标点不在一条X轴上,显得就特别难看。
2017年02月13日 07点02分 1
level 1
无敌小猪z 楼主
var colors = ['
#5793f3', '#
d14a61', '#675bba'];
option = {
color: colors,
tooltip: {
trigger: 'axis'
},
grid: {
right: '20%'
},
toolbox: {
feature: {
dataView: {show: true, readOnly: false},
restore: {show: true},
saveAsImage: {show: true}
}
},
legend: {
data:['蒸发量','降水量','平均温度']
},
xAxis: [
{
type: 'category',
axisTick: {
alignWithLabel: true
},
data: ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月']
}
],
yAxis: [
{
type: 'value',
name: '蒸发量',
position: 'right',
axisLine: {
lineStyle: {
color: colors[0]
}
},
axisLabel: {
formatter: '{value} ml'
}
},
{
type: 'value',
name: '降水量',
position: 'right',
offset: 80,
axisLine: {
lineStyle: {
color: colors[1]
}
},
axisLabel: {
formatter: '{value} ml'
}
},
{
type: 'value',
name: '温度',
position: 'left',
axisLine: {
lineStyle: {
color: colors[2]
}
},
axisLabel: {
formatter: '{value} °C'
}
}
],
series: [
{
name:'蒸发量',
type:'bar',
data:[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]
},
{
name:'降水量',
type:'bar',
yAxisIndex: 1,
data:[2.6, 5.9, -9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]
},
{
name:'平均温度',
type:'line',
yAxisIndex: 2,
data:[2.0, 2.2, -3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, -12.0, 6.2]
}
]
};
2017年02月13日 07点02分 2
level 1
无敌小猪z 楼主
楼上是代码
2017年02月13日 07点02分 3
level 1
无敌小猪z 楼主
有人说 axisLine 的 onZero这个 属性可以设置,但是我试过没有用,不知道哪位大神能帮忙解决一下。
2017年02月13日 07点02分 4
level 1
楼主解决了这个问题吗?我也遇到了这个问题
2017年04月12日 05点04分 5
level 1
楼上两位问题解决没有同求
2017年06月08日 23点06分 6
level 1
遇到同样的问题,楼主是否已解决
2017年06月23日 07点06分 7
level 1
无敌小猪z 楼主
并没有完美的解决,只是通过计算设置最大最小值,将两边的坐标等比例设置,就可以看着0点坐标在一条线上。
2017年06月27日 01点06分 8
请问下你是怎么解决的呢。。你是只解决了这个图标。。还是应用到其他地方了啊。。想知道是怎么计算的。。。[委屈][委屈]
2017年07月27日 03点07分
请问下你是怎么解决的呢。。你是只解决了这个图标。。还是应用到其他地方了啊。。想知道是怎么计算的。。。[委屈][委屈]
2017年07月27日 03点07分
@姿态丶IY 就是等比例计算,比如坐标是 -1到7 右边是-2 到6,就把左边坐标设置成最小值-1最大值7,右边最小值-2最大值14
2017年08月01日 06点08分
@无敌小猪z 哇 写这个的时候写死我了。。。- - 圈复杂度严重超标。。情况好多
2017年08月13日 15点08分
level 1
这样设置貌似可以
2017年11月14日 03点11分 10
1