2014-04-07 64 views
0
require([ 
    "dojox/charting/Chart", 
    "dojox/charting/action2d/Tooltip", 
    "dojox/charting/themes/Tom", 
    "dojox/charting/plot2d/Lines", 
    "dojox/charting/plot2d/Markers", 
    "dojox/charting/axis2d/Default", 
    "dojo/domReady!"], function (Chart, Tooltip, theme, LinesPlot) { 
    var chartData = [4.92, 4.98, 4.89]; 
    var chart = new Chart("chartNode"); 
    var tip = new Tooltip(chart, "default"); 

    chart.setTheme(theme); 

    chart.addPlot("default", { 
     type: LinesPlot, 
     markers: true 
    }); 

    chart.addAxis("x"); 
    chart.addAxis("y", { 
     min: 4.90, 
     max: 5.0000, 
     vertical: true 
    }); 

    chart.addSeries("Monthly Sales", chartData); 

    chart.render(); 
}); 

demo提示在圖表

該圖表工作正常,但激活了提示選項不能正常工作。但是我找不到原因。問題是什麼?

回答

0

您甚至在添加圖形「default」之前設置工具提示。如果您在添加圖形「default」後移動工具提示聲明,那麼它應該可以正常工作。這裏是您重新設置工具提示的示例。

chart.addPlot("default", { 
    type: LinesPlot, 
    markers: true 
}); 
var tip = new Tooltip(chart, "default"); 

http://jsfiddle.net/jxJZ6/2/