airblade/chartjs-ror

Multiple chart in one page?

Closed this issue · 4 comments

I want to show multiple chart in one page, for example using this:

<%= chartjs_line_chart @DaTa, @options %>
<%= chartjs_pie_chart @datastaffcount %>

but when its rendered it only show first chart and the other is blank.

Did you ever see a problem like this?

That's odd. I have three charts on one page in one of my projects.

Does it work if you specify an explicit id for each chart?

What error do you see in the browser's javascript console?

I'll be able to look into this more when I get back from holiday.

thanks airblade for your help.

If i add two chart in same div tag it ok. its rendered. But when I add two chart under different divs, it isnt rendered.

Then i apply you suggestion and i specify an explicit id for each chart and ta taa.

Now two charts are rendered under different divs without any problem.

Again thanks for your help airblade.

I'm glad it works when you specify an explicit id for each chart...but it should work without you having to do that. I have a page in my app with three charts and it renders without my having to specify the ids.

What does the HTML generated look like when you don't specify ids?

I can't reproduce this and it's gone quiet, so I'm closing this. I'm happy to re-open it if you're still having problems.