CodeYellowBV / chartist-plugin-legend

Legend plugin for Chartist.js.
https://codeyellowbv.github.io/chartist-plugin-legend/
Other
116 stars 62 forks source link

When there are multiple charts on a page, only 1 legend gets rendered. #17

Closed paul-apacio closed 8 years ago

paul-apacio commented 8 years ago

As in my subject. I have multiple charts on my page, but the legend only gets rendered once for the whole page.

SpaceK33z commented 8 years ago

https://codeyellowbv.github.io/chartist-plugin-legend/

In the demo this appears to be working...

paul-apacio commented 8 years ago

I should clarify, when there is more than one of the same chart.

-Paul

On 19 Apr 2016, at 13:41, Kees Kluskens notifications@github.com wrote:

https://codeyellowbv.github.io/chartist-plugin-legend/ https://codeyellowbv.github.io/chartist-plugin-legend/ In the demo this appears to be working...

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/CodeYellowBV/chartist-plugin-legend/issues/17#issuecomment-211904562

aualdrich commented 8 years ago

@paul-apacio Did you ever find a workaround to this? I'm having the same issue.

t2 commented 8 years ago

This seems like a big flaw. We have a dashboard of multiple Chartist charts and needs legends for each. Did you ever find a way to resolve this @paul-apacio?

SpaceK33z commented 8 years ago

I'm working on a fix right now.

paul-apacio commented 8 years ago

My resolution was to simply render the legends separate to the chart as plain html, as I was passing the data in at render time, so it was available to me.

SpaceK33z commented 8 years ago

@aualdrich, @t2, can you share an example of when this is happening? I added a test (61ed13e33d1a4e1a8e5d559ac358431a6896961d) to try to reproduce it, but it appears to work...

michalchovanak commented 8 years ago

Hi, i am having the same issue. I have 3 charts in a slick.js slider and only one renders the legend.

SpaceK33z commented 8 years ago

Can you provide a minimal reproducable scenario?

monossido commented 8 years ago

up?! I'm using angular-chartist and I have not understand the workaround

SpaceK33z commented 8 years ago

As long as no-one provides a reproducable scenario, I can't fix this.... a PR is also welcome.

paul-apacio commented 8 years ago

A reproducible scenario would simply be to attempt to create 3 bar charts, with legends on the same page, but using similar data.

When I had this problem back in April, only the first chart's legend would get rendered.

I worked around this by rendering the legend using plain HTML outside of chartist, but that negates the point of the plugin.

SpaceK33z commented 8 years ago

But looking at the demo, this appears to work. Even if I change the Line charts there to Bar charts, it still works. Can you provide a demo (with JSBin or whatever)?

paul-apacio commented 8 years ago

Then it would appear the issue must be fixed.

SpaceK33z commented 8 years ago

I'll close this issue for now then. If anyone still has this issue, please provide a working demo and I'll re-open this.

monossido commented 8 years ago

This bug comes with a different version of the library, if you install the plugin with bower it will download this forked version https://github.com/Pinacono/chartist-plugin-legend Installing it with npm solved the issue.