-
Notifications
You must be signed in to change notification settings - Fork 19.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Stacked bar chart is missing a bar when log scale is used #19517
Comments
See conclusion at #19234. Stacked bars using log axis is misleading and thus this problem is not going to be fixed. |
I agree it might be misleading. I'd like to offer a few brief points for reconsideration:
For example, this matplotlib code allows to render log scaled stacked bars: import matplotlib.pyplot as plt
categories = ['First', 'Second']
values1 = [1, 2000]
values2 = [2500, 3000]
fig, ax = plt.subplots()
ax.bar(categories, values1, label='Series 1')
ax.bar(categories, values2, bottom=values1, label='Series 2')
# Setting the y-axis to logarithmic scale - ok
ax.set_yscale('log')
plt.xlabel('Categories')
plt.ylabel('Values')
plt.title('Stacked Bar Chart with Log Scale')
plt.legend()
# Display the plot
plt.show() Results in this nice looking image: I hope the Pull request can be accepted as it limits the impact to a very narrow case and address one of our own concerns. Thank you! |
If you like the matplot image, just replace '-' with 1 in the data and you'll get the exact same result |
That's essentially what the PR is doing |
I think data transformation is a developer's task, it should not be part of any charting library. |
Version
5.4.3
Link to Minimal Reproduction
https://echarts.apache.org/examples/en/editor.html?code=PYBwLglsB2AEC8sDeAoWsCG0IFsORgC5YAzDAGwGcBTAGjVjGGHMhGKQF970BPAQQAeEShwbowvENWIBycsADmshtwaChIseglSZsWQGN81RcABOvWTx0ATfBmIBtWQDEI5ymGsGAytUMYW1kAXVUbGnMIalFYJ3FkBN1pOQAjDHNrJNgAehzYVIBXRWIwAAtqc2pYSkKQEGAaW0ZgAuryquqqwzAsRXIY2BhGCprDTuhsvNgAeWhyXkYAd1aM6ttzDCXoADps-17nWQBaHwAmAAYrkJsdGt7DAGs5PAhoFTu1O9Q75P1ZdKZW52BzOM4AViutFgAGYrhcbtkvBgni8MG8PjpOAwwpwANxAA
Steps to Reproduce
Use the following configuration:
Current Behavior
Looks like starting from version
5.3.0
the stacked bar chart with log scale is no longer rendered correctly when one of the stacks has no data marker (-
). IExpected Behavior
Expected to see all three bars present.
Environment
Any additional comments?
Looks like the bug was introduced by this commit in the
barGrid.ts
component - in pre 5.3.0 version the computation accounted for log scale correctly. In 5.3.0+ the log(0) is used to determine the height of the bar, which gives a negative infinity and lack of the rendered rectangle.The text was updated successfully, but these errors were encountered: