简体   繁体   中英

Dojox tooltips don't show up on mouse over

I am getting crazy while rendering a simple line chart with dojo toolkit. Everything is fine except that tooltips don't show up on mouse over. ChartData is a list of objects having this structure:

    [{'x':x1, 'y':y1, 'tooltip':"some text"}, {...}, ...]

The magnify animation works on both Chrome and Firefox. I tried to change theme as suggested here but still no results. What I am doing wrong?

    require([ 
    "dojox/charting/Chart",
        "dojox/charting/axis2d/Default",
        "dojox/charting/plot2d/Lines",
        "dojox/charting/themes/MiamiNice",
        "dojox/charting/action2d/Tooltip",
        "dojox/charting/action2d/Magnify"],
        function(Chart, Tooltip, Magnify, themes, Lines, Default) {
        var chartData = data["res"];
        var chart = new Chart("graph", {title: data["title"], 
                              titleFontColor: "#79B30B"});

        chart.addAxis("y", {vertical: true, min: 0, max:110});
        chart.addAxis("x");
        chart.addPlot("default", { type: "Lines", markers: true, 
                                   tension:3,
                                   shadows: {dx: 2, dy: 2, dw: 2} } );
        chart.setTheme(dojox.charting.themes.MiamiNice);
        chart.addSeries("Connectivity[%]", chartData);
        var tooltip = new dojox.charting.action2d.Tooltip(chart, "default");
        var magnify = new dojox.charting.action2d.Magnify(chart, "default");
        chart.render();
      });

Many thanks Frode, the solution is to load the dijit theme in the head of the HTML page In my code will be MiamiNice instead of Claro.

  <style type="text/css">
  @import
  url("http://archive.dojotoolkit.org/nightly/dojotoolkit/dijit/themes/claro/claro.css");
  </style>

I had an issue where my tooltips were not being shown on a line chart. I changed markers:false to markers:true when adding the plot to the chart and the tooltips started to show up.

mapChart1.addPlot("default", {
    type : dojox.charting.plot2d.Lines,
    markers : true
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM