apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.76k stars 19.62k forks source link

[Bug] Bar charts: I set up three serie, one to draw a line chart, the other two to draw a bar chart, and the three series all to stack. The serie of the line chart has very large data, the other two have very small data, and I set the minimum height of the columns for the two bar charts. At this time, a strange phenomenon will occur: the two columns will block each other, and it is reasonable to say that the minimum height of the two columns should be displayed #19038

Open liuqituo opened 1 year ago

liuqituo commented 1 year ago

Version

5.4.3

Link to Minimal Reproduction

https://echarts.apache.org/examples/zh/editor.html?c=line-simple(The simplest line chart example on the official website can be)

Steps to Reproduce

  1. Open the above case address
  2. Copy the code below into it 3, mouse over the legend to try

code: const colors = ['#5470C6', '#91CC75', '#EE6666']; option = { legend: { data: ['Evaporation', 'Precipitation', 'Temperature'] }, xAxis: [ { type: 'category', axisTick: { alignWithLabel: true }, // prettier-ignore data: ['Jan', 'Feb'] } ], yAxis: [ { type: 'value', show: false, name: '温度', position: 'left', }, ], series: [ { name: 'Evaporation', type: 'bar', stack:'total', barMinHeight:10, data: [ 2.0, 4.9 ] }, { name: 'Precipitation', type: 'bar', stack:'total', barMinHeight:10, data: [ 2.6, 5.9 ] }, { name: 'Temperature', type: 'line', stack:'total', data: [20000, 20000] } ] };

Current Behavior

The minimum height set for the bar appears to be invalid, or in effect, but one is obscured

Expected Behavior

Hopefully, the minimum height of the two bars is set so that both can be seen and will not block each other

Environment

- OS:
- Browser:
- Framework:
The above official website example can be

Any additional comments?

No response

MatthiasMert commented 1 year ago

It seems that echarts computes the stacked series from the data point of the previous stack and doesnt take the visual minimum height into account (which is the correct way in my opinion). The bars just overlap because the difference between them is smaller than 1 pixel on the yAxis and thus cannot be displayed. Here is an example which illustrates this nicely.

As a solution to your problem I would suggest using axis type 'log'. Here is an example.

helgasoft commented 1 year ago

everyone be careful using stacked bars with log scale - see example in #18330

liuqituo commented 1 year ago

It seems that echarts computes the stacked series from the data point of the previous stack and doesnt take the visual minimum height into account (which is the correct way in my opinion). The bars just overlap because the difference between them is smaller than 1 pixel on the yAxis and thus cannot be displayed. Here is an example which illustrates this nicely.

As a solution to your problem I would suggest using axis type 'log'. Here is an example.

Sorry, but I am using Echarts to do large screen projects, we will support users to configure a lot of Echarts configuration, including the type of Y axis (can choose value or log), if the user wants to configure the type of Y axis as 'value', There seems to be no way to fix this problem by setting it to log

liuqituo commented 1 year ago

everyone be careful using stacked bars with log scale - see example in #18330

Sorry, but I am using Echarts to do large screen projects, we will support users to configure a lot of Echarts configuration, including the type of Y axis (can choose value or log), if the user wants to configure the type of Y axis as 'value', There seems to be no way to fix this problem by setting it to log