I’m just playing with jqplot for a few hours but I couldn’t find how to specify the target in a more specific jquery way.
for example if I have the html code:
<div id="chart"></div>
I can create the chart using
$.jqplot("chart", [], {});
and it will create a chart on the element with id: chart.
What I want is to use something like this:
$("#chart").jqplot([], {});
or
$(".multiple_charts").jqplot([], {});
or
var myChart=$("<div></div>");
myChart.jqplot([], {});
I saw that this problem was already proposed in 2009 here: https://bitbucket.org/cleonello/jqplot/issue/114/jqplot-target-should-accept-any-element
Is there a solution to what I’m looking for?
Thanks
From looking at the code, you could indeed see that
$.jqplotonly accepts the target element’s id as first argument, so you’re right about that.However
$.fn.jqplotis also defined, which means that you can use$(".multiple_charts").jqplot();or$("<div></div>").jqplot();. Note that jqplot creates a unique id for each element in the jquery object if it doesn’t already exist.Oh, it looks like the version I looked at is not out yet, but you could just grab the latest code and make a workaround.