2010-11-20 82 views
2

即時通訊使用jquery:http://www.jqplot.com/和我做了一個很好的圖表。 我得到的唯一問題是這樣的: 當圖表超過300像素的IM時,我想讓熒光筆tooltiplocation去'nw',如果它的'ne'更小。jquery,jqplot更改選項值

當前選項:

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

沒有任何人知道如何呈現其改變後的位置,德?

回答

3

我認爲你必須保存在一個變量jQPlot函數的返回值:

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

,然後可以設置不同的選擇這種方式並重繪:

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

這是很好的解釋在這裏: Google Groups

您可以使用:

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

,並在同一個目標(your_jqplot_target)創建新的

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

像桑德羅大號說,如果保存jQPlot函數的返回值的變量:

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

那麼你可以設置一系列新的或選擇它並targetPlot.redraw();targetPlot.replot();它以後。請在上面鏈接的頁面上閱讀更多內容。

+0

對不起,我知道這是一個老問題,但它對我來說並不完整...... – Dichev 2011-08-18 17:44:55