echarts icon indicating copy to clipboard operation
echarts copied to clipboard

[Feature] 是否能支持y轴配置0刻度对齐

Open daisy0123 opened this issue 1 year ago • 18 comments

What problem does this feature solve?

当我使用双y轴的时候,主y轴有负值,次y轴没有负值,这样导致0刻度不对齐,容易误导看数, image

What does the proposed API look like?

y轴支持配置0刻度对齐,次y轴的0刻度和主y轴的0刻度对齐

daisy0123 avatar Apr 21 '23 07:04 daisy0123

@daisy0123 It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗

TRANSLATED

TITLE

[Feature] Whether the y-axis configuration of 0 scale equivalence can be supported

BODY

What problem does this feature solve?

When I use double y-axis, the main y-axis has negative values, and the secondary y-axis has no negative values, which leads to unequal 0 scales, which is easy to mislead the reading. image

What does the proposed API look like?

The y-axis supports configuration of 0 scale equivalence

echarts-bot[bot] avatar Apr 21 '23 07:04 echarts-bot[bot]

试一试启用 yAxis.alignTicks 坐标轴刻度对齐看看?

plainheart avatar Apr 21 '23 09:04 plainheart

试一试启用 yAxis.alignTicks 坐标轴刻度对齐看看?

这个使用了 刻度是对齐了,但是0刻度没有对齐,因为次y轴的数据没有负数

daisy0123 avatar Apr 21 '23 09:04 daisy0123

Is this a solution? with yAxis.min and alignTicks - Demo Code image

helgasoft avatar Apr 27 '23 07:04 helgasoft

Is this a solution? with yAxis.min and alignTicks - Demo Code image

我这边不是固定写一个图表,是数据平台,通过查询的数据进行绘制,需要获取y轴的间隔数据才能设置y轴的最小值,需要计算,所以希望平台可以提供这个参数配置

daisy0123 avatar Apr 27 '23 08:04 daisy0123

It needs to be calculated, so I hope the platform can provide this parameter configuration

Currently it is not automatic, but yAxis.min could indeed be calculated and set - Demo Code Does this work with your data?

helgasoft avatar Apr 27 '23 20:04 helgasoft

It needs to be calculated, so I hope the platform can provide this parameter configuration

Currently it is not automatic, but yAxis.min could indeed be calculated and set - Demo Code Does this work with your data?

非常感谢,不过希望可以初次绘制的时候就能达到这样的效果,等绘制完再getoption处理 对数据平台的性能有所影响,我们的面板承载的报表很多,所以希望echarts在首次绘制y轴刻度的时候就根据配置开关来计算,实现0刻度对齐

daisy0123 avatar Apr 28 '23 03:04 daisy0123

It needs to be calculated, so I hope the platform can provide this parameter configuration

Currently it is not automatic, but yAxis.min could indeed be calculated and set - Demo Code Does this work with your data?

在网上找了很多方案,发现不少人也是有这个需求的,但是他们计算的规则和我的数据不符合

daisy0123 avatar Apr 28 '23 03:04 daisy0123

getoption processing will have an impact on the performance of the data platform I hope that echarts will draw the y-axis scale for the first time

Of course it could be done without getOption - Demo Code Now all you have to do is fill xdata, yd1 and yd2 with your data and give it a go.

helgasoft avatar Apr 28 '23 04:04 helgasoft

getoption processing will have an impact on the performance of the data platform I hope that echarts will draw the y-axis scale for the first time

Of course it could be done without getOption - Demo Code Now all you have to do is fill xdata, yd1 and yd2 with your data and give it a go.

thanks,I try try.

daisy0123 avatar May 04 '23 03:05 daisy0123

getoption processing will have an impact on the performance of the data platform I hope that echarts will draw the y-axis scale for the first time

Of course it could be done without getOption - Demo Code Now all you have to do is fill xdata, yd1 and yd2 with your data and give it a go.

还是不行,我其中一个图表的数据是这样的 yd1 = [ 1356664864, 1465570182, 1530020458, 1540500149, 1480651815, 1502250584, 1575832697, 102514202, 108905318, 64450276, 10479691, -59848334, 21598769, 73582113 ]; yd2 = [ 0.08173994170406937, 0.08027429683621555, 0.04397624678201866, 0.006849379657118284, -0.038849937170632495, 0.014587338347334548, 0.048981251053386174 ];

daisy0123 avatar May 10 '23 06:05 daisy0123

their calculation rules do not match my data.

I see, turns out my method too does not work for all data combinations. When data is so different the logical choice is to build two separate charts.

helgasoft avatar May 10 '23 17:05 helgasoft

their calculation rules do not match my data.

I see, turns out my method too does not work for all data combinations. When data is so different the logical choice is to build two separate charts.

我这边支持用户拖拽做表,所以数据是不固定 无规则,差异也无规则的,我在绘制的时候处理很难兼容全部数据case,希望echarts在计算y轴的时候支持0刻度对齐,支持配置,

daisy0123 avatar May 11 '23 02:05 daisy0123

their calculation rules do not match my data.

I see, turns out my method too does not work for all data combinations. When data is so different the logical choice is to build two separate charts.

你好,这个有下文么?可以帮忙支持吗

daisy0123 avatar May 26 '23 03:05 daisy0123

+1 同需要 多y轴,0刻度对齐。

mmmml-zhao avatar Oct 08 '23 02:10 mmmml-zhao

+1

liboliang01 avatar Jan 22 '24 13:01 liboliang01

项目需要,手动敲了个粗糙的对齐功能 示例 就是没显示零刻度线,其他对齐了

Hoody123 avatar Apr 25 '24 08:04 Hoody123

@Hoody123 - looks pretty good!
Even with @daisy0123's latest (strange) example data - Demo. Maybe you found the magic formula 🧙 image

helgasoft avatar Apr 25 '24 17:04 helgasoft

+1 同需要 多y轴,0刻度对齐。

miaoyuxinbaby avatar Aug 08 '24 03:08 miaoyuxinbaby