문제

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

This chart works fine, except with the tooltip option activated. However i can't find the reason of that. What is the problem?

도움이 되었습니까?

해결책

You're setting the Tooltip before you even add the plot "default". If you move your tooltip declaration after adding the plot "default", then it should work fine. Here is your example with the tooltip rearranged.

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

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top