Duplicate chart into two divs different.

39 views
Skip to first unread message

Rafael Arevalo

unread,
Feb 13, 2015, 11:54:56 AM2/13/15
to flot-...@googlegroups.com


Hello. I must show the same chart into two divs different but they are in the same section.

Example.

<body>
<div class="one">
<div class="chart-1"></div>
</div>

<div class="thow">
<div class="chart-1"></div>
</div>

</body>

_______________________________

For some reason, only shows the second div.
Someone could tell me how?

Ced

unread,
Feb 15, 2015, 3:59:01 AM2/15/15
to flot-...@googlegroups.com
Flot doesn't work like most jQuery plugins.  It's not chainable, and it won't work on selections that include multiple elements.
You need to call $.plot() once for each plot.  See the zooming with overview example.

You probably need id attributes on your chart divs.

<div id="chart-1" class="chart"></div>
<div id="chart-2" class="chart"></div>

When you plot, you use the div id as the jQuery selector:
$.plot("#chart-1", data, options);
$.plot("#chart-2", data, options);
Reply all
Reply to author
Forward
0 new messages