2013-05-03 112 views
0

我正在使用jquery jqplot(條形圖)和ruby on rails應用程序。我將發送日期作爲2012年4月,並以美元計算。在鼠標懸停工具提示上顯示的日期爲索引,即 [1,$ 200],[2,$ 300]而不是日期(2013年4月)。我怎樣才能取代這個指數與日期?其中 日期位於x軸上,數量位於y軸上。 這裏是我的熒光筆代碼:在jqplot工具提示顯示日期

highlighter: 
    show: true 
    showMarker: false 
    formatString: '<table class="jqplot-highlighter"> 
       <tr><td><b>%s</b></td><td><b>%s</b></td> 
       </tr></table>' 
+0

日期出現在哪個軸? – rony36 2013-05-03 05:46:53

+0

x軸上存在日期 – Arif 2013-05-03 06:55:01

回答

0

你有沒有加入這個JS?

<script type="text/javascript" language="javascript" src="plugins/jqplot.dateAxisRenderer.js"></script> 

而且試試這個:

highlighter: { 
    tooltipAxes: 'y', 
    yvalues: 2, 
    formatString: '<table class="jqplot-highlighter"> 
        <tr><td><b>%b</b></td><td><b>,%Y</b></td> 
        </tr></table>' 
} 

More details.

+0

進行了更改。試試看。 – rony36 2013-05-03 07:41:06

+0

感謝您的回覆。我嘗試過這個。它不能正常工作。在工具提示中,%Y按原樣顯示。日期未正確呈現。 – Arif 2013-05-03 10:23:07

+0

請把'tooltipAxes:'y''和'yvalues:2'放到'%s'上 – rony36 2013-05-03 11:13:59