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

Fix missing legend in Bar chart #362

Merged
merged 2 commits into from
Dec 2, 2018

Conversation

AhyoungRyu
Copy link
Contributor

@AhyoungRyu AhyoungRyu commented Nov 30, 2018

Another trial to fix #111 or #218

So the problem that I aim to fix here is, if some keys have 0 as value in first column, it doesn't generate legend at all even if other columns have non-zero value.

Related conversation is also in #128 which is a first trial to fix this issue. I saw #219 as well and I understand there might be more cases we can improve.
But I think many ppl including me, this missing legend with zero value in 1st column issue is more urgent I think.

tl; dr

Before

screen shot 2018-11-30 at 2 17 13 pm

After

screen shot 2018-11-30 at 2 17 04 pm

Also applied in Canvas
screen shot 2018-11-30 at 2 12 51 pm

@@ -152,22 +153,23 @@ const Bar = props => {
targetKey: 'data.fill',
})

const legendDataForKeys = result.bars
.filter(bar => bar.data.index === 0)
const legendDataForKeys = uniqBy(result.bars
Copy link
Contributor Author

@AhyoungRyu AhyoungRyu Nov 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I don't wrap this \w uniqBy then duplicated legends will be generated

@justincrow
Copy link

awesome - when will this fix be published?

@AhyoungRyu
Copy link
Contributor Author

Yeah I also wondered too ;)
@plouc When will be the next release ?

@stahlmanDesign
Copy link

I saw this was finally fixed with v0.52.0!
capture d ecran 2018-12-10 a 17 37 06

@justincrow
Copy link

justincrow commented Dec 11, 2018 via email

@AntonPuko
Copy link

ehhh..can this be evaluated not only in the first bar?
with current calculations its not possible to use legend in realtime chart like this:
image
where the first bar can be empty.
:(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

legendDataForKeys() missing data
5 participants