Dojox Charting。无法更改MouseIndicator的指示线样式

时间:2016-11-08 10:33:07

标签: dojo dojox.charting

我尝试使用Dojox图表创建图表。我创建了情节并添加了系列。

this.addPlot("st", {type: Lines, markers: false, tension:"X"});

this.addSeries("Series A",
               [{x:0, y:0}, {x:5, y:10},
                {x:10, y:12}, {x:15, y:14},
                {x:20, y:15}, {x:25, y:16},
                {x:30, y:18}],
               {plot: "st"});

然后我添加了MouseIndicator

new MouseIndicator (this, "st",
             {series: "Series A",
              labels: false,
              mouseOver: true,
              lineStroke: { color: "blue" }   
             });

所以它添加了指标但默认颜色。 尝试使用lineStroke,lineOutline或lineShadow更改指标。什么都没有改变。

根据API文档,它应该更改线条样式^ http://bill.dojotoolkit.org/api/1.9/dojox/charting/action2d/MouseIndicator

有人知道如何更改MouseIndicator线型吗?

1 个答案:

答案 0 :(得分:0)

这是我的解决方案。

使用dojo / aspect(http://dojotoolkit.org/reference-guide/1.10/dojo/aspect.html)来监听" _onMouseSingle" MouseIndicator对象,在此事件发生后,更改标记和线条笔划颜色:

var mouseHoverIndicator = new MouseIndicator (this, "st",{
        series: "Series A",
        labels: false,
        mouseOver: true,
        lineStroke: { color: "blue" }   
    });

aspect.after(mouseHoverIndicator, "_onMouseSingle", function (value) {
    var plot = mouseHoverIndicator.chart.getPlot(mouseHoverIndicator._uName);
    plot.opt.markerStroke=  {color:"blue"};
    plot.opt.lineStroke= {color:"blue"};
    plot.dirty = true;
    mouseHoverIndicator.chart.render();
});