stefan
stefan

Reputation: 21

jquery, jqplot change option value

im using jquery: http://www.jqplot.com/ and i made a nice chart. the only problem i got is this: when im over 300 pixels of the chart, i want the highlighter tooltiplocation go's to 'nw' if its smaller its 'ne'.

current options:

  highlighter: {
       tooltipLocation: 'ne',
       useAxesFormatters: true,
   },

does anybody know how to change te location after its rendered?

Upvotes: 2

Views: 2161

Answers (2)

Sandro L
Sandro L

Reputation: 1160

I think you have to save the return value of jQPlot function in a variable:

targetPlot = $.jqplot(...your diagram...)

and can then set different options this way and replot:

targetPlot['legend']['location'] = "ne";
targetPlot.replot();

Upvotes: 3

Dichev
Dichev

Reputation: 168

It is explained very well here: Google Groups

You can use:

$("#your_jqplot_target").empty();

and create new

$.jqplot('...your diagram options here...');

in the same target (your_jqplot_target).

Like Sandro L said, if you save the return value of jQPlot function in a variable:

targetPlot = $.jqplot('...your diagram...');

Then you can set new series or options to it and targetPlot.redraw(); or targetPlot.replot(); it later. Please read more on the page linked above.

Upvotes: 1

Related Questions