Skip to content
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

Floating Stacked Bar Chart problem + Duplicate legend problem #11730

Open
birko opened this issue Apr 3, 2024 · 0 comments
Open

Floating Stacked Bar Chart problem + Duplicate legend problem #11730

birko opened this issue Apr 3, 2024 · 0 comments

Comments

@birko
Copy link

birko commented Apr 3, 2024

Expected behavior

  • Creating Stacked bar chart with floated bars should use values given in data to display bars correctly on the chart.
  • Datasets with same label defined should have same color and use the same legend

Current behavior

In given example bellow you can see that:

  • on lines 27 and 28 of javascript i needed to subtract the values from previous dataset so the bar would be positioned correctly in chart. It then shows wrong text when creating tooltip.
  • Despite dataset 3 and 4 have the same label name it created a new legend and new color for the 4th dataset bar.

Reproducible sample

https://codepen.io/birko/pen/dyLJmmE

Optional extra steps/info to reproduce

No response

Possible solution

  • when calculating bar positions for stacked bar chart disable values combination when using floated bars data values.
  • if dataset.label is defined in the data.labels property. before creating new legend definitions for a dataset. It should lookup if the legend with the same name does not exists and use it instead

Context

In our company we need to create a chart that show how long was an item (in example task) was by certain state (worker).
For the visualization we needed to show it in a form of horizontal bar chart.

chart.js version

4.3

Browser name and version

Edge 123.0.2420.65

Link to your project

No response

@birko birko added the type: bug label Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant