如何为Dojox图表添加自定义工具提示?

时间:2010-12-28 15:08:08

标签: charts dojo

说我有这个:

        var chart1 = new dojox.charting.Chart2D("traffic");
    chart1.addPlot("default", {type: "Columns", gap: "15"});
    chart1.addAxis("x", {minorTicks: false, font: "normal normal bold 9pt Arial",
    labels: [{value: 1, text: 'Monday'},{value: 2, text: 'Tuesday'},{value: 3, text: 'Wednesday'},{value: 4, text: 'Thursday'},{value: 5, text: 'Friday'},{value: 6, text: 'Saturday'},{value: 7, text: 'Sunday'}]});
    chart1.addAxis("y", {vertical: true, minorTicks: false, min: 0, font: "normal normal bold 12pt Arial"});
    chart1.addSeries("Series 1", [<?php echo $trafficseries; ?>]);
    chart1.setTheme(dojox.charting.themes.PlotKit.blue);
    chart1.addPlot("Grid", {
        type: "Grid",
        hAxis: "x",
        vAxis: "y",
        hMajorLines: true,
        hMinorLines: false,
        vMajorLines: false,
        vMinorLines: false
    });
    var anim_t = new dojox.charting.action2d.Tooltip(chart1, "default");
    chart1.render();

我如何更改该工具提示以说明我需要说什么?我需要把X数据放在那里。

2 个答案:

答案 0 :(得分:2)

这可以通过向系列数据添加工具提示值来完成:

chart1.addSeries("Series 1", [{x:1,y:4,tooltip:"Value is 1"},{x:2,y:6,tooltip:"Value is 2"}]);

答案 1 :(得分:0)

你可以,新的工具提示(图表1,&#34;默认&#34;,{text:function(o){return oy +&#34; M / s&#34 ;;}});,自定义文本值设置一个功能。