Changing Legend in the Future of Dynamic Data Display wpf

♀尐吖头ヾ 提交于 2019-12-14 02:33:39

问题


I have been using the Future d3 but can not figure out how to change the series legend. In the older builds the legend could be changed like:

    graf = plotter.AddLineGraph(new CompositeDataSource(xSrc, plot),
                 new Pen(brush, 4),
                 new PenDescription("myText" ));

but here the function call to AddLineGraph takes an object as argument and hence one can not specify the pendescription... Please does anyone know how to do this? This question was asked before here but did not get any answers. Any help would be highly appreciated. I have spend a lot of time on this and dont want to change to any other library just because of this small issue...


回答1:


The above doesn't work with recent (2016) v0.4.0.

v0.4.0 uses the following syntax:

// For access to the Legend class
using Microsoft.Research.DynamicDataDisplay.Charts;

... snip ...
LineGraph lineGraph = new LineGraph(dataSource);
lineGraph.LinePen = new Pen(Brushed.Green, 1.0);
Legend.SetDescription(lineGraph, "The line label");
plotter.Children.Add(lineGraph);
... snip ...

v0.3.0 used the following syntax:

plotter.AddLineGraph(dataSource, pen, marker, new PenDescription("The line label"));

Ref: Changing and setting the Legend (LineGraph) Future of DynamicDataDisplay

Post http://d3future.codeplex.com/discussions/635917 provided the core fix.



来源:https://stackoverflow.com/questions/29945965/changing-legend-in-the-future-of-dynamic-data-display-wpf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!