fxcosta / laravel-chartjs

Simple package to facilitate and automate the use of charts in Laravel 5.x using Chartjs v2 library
486 stars 112 forks source link

Render Chart on Tabs (Bootstrap) #47

Closed jocarullo closed 7 years ago

jocarullo commented 7 years ago

When I try to render multiple charts on tabs in bootstrap using your package it only displays one chart (on the starting active tab) but does not display on other tabs. Thanks. ul class="nav nav-tabs"> li class="active">a data-toggle="tab" href="#home">Home li>a data-toggle="tab" href="#menu1">Menu 1 li>a data-toggle="tab" href="#menu2">Menu 2 /ul> div class="tab-content"> div id="home" class="body tab-pane fade in active" style="width: 95%;"> {!! $chartjs->render() !!} {{--

--}} /div> div id="menu1" class="body tab-pane fade" style="width: 95%;"> {!! $chartjs->render() !!} {{--
--}} /div> /div>

fxcosta commented 7 years ago

@jocarullo I reproduced the problem but suspected it would not work because the charts are built using the element id, where we set using the name() and element() builder method.

Basically if you have two charts to display, each one in a tab, they must be different, so they are of a different instance. If I understand your problem better maybe I can help you building a solution.

Thanks and sorry for delay.

MGS-sails commented 7 years ago

Any progress with this bug? I have thesame problem. If not, could you suggest a workaround?

tmdevde commented 5 years ago

me too...

rexlManu commented 4 years ago

me too...