开发者

jquery, jqplot change option value

开发者 https://www.devze.com 2023-01-26 05:34 出处:网络
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 sma

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:开发者_如何学C {
       tooltipLocation: 'ne',
       useAxesFormatters: true,
   },

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


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();


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消