PF 3.4RC1 jqplot resize on parent resize.

UI Components for JSF
Post Reply
sreedharg
Posts: 8
Joined: 05 Apr 2012, 09:19

07 Sep 2012, 16:34

Hi,
Since resize on chart is not yet supported in 3.4 RC1,
I tried the following link to resize the line chart when the dialog is resized (Showing the chart in a modal dialog)

http://www.jqplot.com/deploy/dist/examp ... ePlot.html

Code: Select all

<p:dialog id="overTheTimeDialog" modal="true" header="Over the time" resizable="true" widgetVar="overTheTime">
						<p:lineChart widgetVar="trend" animate="true" zoom="true" id="overTheTimeID" value="#{performanceTrendViewBean.overTheTimeLinearlModel}" 
						legendPosition="ne" title="Trend over a period of time"  xaxisAngle="0" yaxisLabel="Response time in seconds" 
						xaxisLabel="Date of execution" showMarkers="true"
						seriesColors="EF6654,58BE5B,FCD800,4A8CF6,626262,000000,FC00C2,551A8B,FC0000,000CBA,54DDEF,F6B44A,75151A,40FF00,FF9D00,008C04,034030,801C54,E0ADCA,6267A6"
						 shadow="true"/>
</p:dialog>
When i use something similar in the link mentioned

Code: Select all

$('#resizableParent').bind('resize', function(event, ui) {
        trend.replot( { resetAxes: true } );
    });
I get error that Object #<c> has no method 'replot'

So i tried another way mentioned in
http://www.jqplot.com/deploy/dist/examp ... yntax.html

getting jqplot plot using jquery data method.

Code: Select all

$('#trendOverID').data('jqplot').replot( { resetAxes: true } );
Then i get $('#overTheTimeID').data('jqplot') as null.

According to jqplot we can get the plot object from jquery data attribute.
is this a bug in primefaces? or am doing something stupid?

Regards
Sree

sreedharg
Posts: 8
Joined: 05 Apr 2012, 09:19

07 Sep 2012, 19:08

Ok...little more debugging, found the answer...
like chart.exportAsImage() we cannot use chart.replot()

we have to do chart.plot.replot().
so doing something like trend.plot.replot({resetAxes:true}); worked.

Regards
Sree

knucki
Posts: 3
Joined: 26 Oct 2012, 14:26

29 Oct 2012, 09:21

Hi sreedharg,

did you have a complete example jsf/xhtml for your solution?

Thank you

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 59 guests