I have p:chart on my site like this
<p:chart id="chart" type="line" widgetVar="chart" model="#{resultsViewController.areaModel}" style="height:600px"/>
Now I want the client to be able to modify some display options without reloading the page, in order to do that I need to acquire the jqplot instance. How can I do that?
I read that you can do it like this: http://forum.primefaces.org/viewtopic.php?f=3&t=24667
But using it like this
$('#chart').data('jqplot').plot.replot( { resetAxes: true } );
yields no data() function
P.S I am aware of the possibility to extend Primefaces renderer for charts but this is not an option for me.
Ok so I found the answer thanks to useful link on PF client side API:
http://blog.hatemalimam.com/intro-to-primefaces-widgetvar/
So the short answer is, you need to assagin a widgetVar atrribute and then using
PrimeFaces
object get instance of jqplot like this:Like this: