jquery,jqplot更改选项值

时间:2010-11-20 09:11:21

标签: jquery

即时通讯使用jquery:http://www.jqplot.com/,我制作了一张漂亮的图表。 我得到的唯一问题是: 当我超过300像素的图表时,如果它的'ne'更小,我想要将荧光笔工具定位变为'nw'。

当前选项:

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

有人知道如何在渲染后改变te位置吗?

2 个答案:

答案 0 :(得分:3)

我认为你必须在一个变量中保存jQPlot函数的返回值:

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

然后可以通过这种方式设置不同的选项并重新绘制:

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

答案 1 :(得分:1)

这里解释得非常好: Google Groups

您可以使用:

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

并创建新的

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

在同一目标(your_jqplot_target)。

如同Sandro L所说,如果将jQPlot函数的返回值保存在变量中:

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

然后,您可以为其设置新的系列或选项,以及稍后targetPlot.redraw();targetPlot.replot();。请在上面链接的页面上阅读更多内容。