我正在使用这个伟大的库https://d3future.codeplex.com/来绘制一些2D图。
在旧的D3中,我常常这样设置传奇:
graf = plotter.AddLineGraph(new CompositeDataSource(xSrc, plot),
new Pen(brush, 4),
new PenDescription("myText" ));但我不知道如何在未来的D3中获得同样的信息。有人能让我看到光明吗?
在探索源代码时,我发现了这一点,但无法理解如何访问和更改默认字符串"LineGraph":
public class LineGraph : PointsGraphBase
{
static LineGraph()
{
Type thisType = typeof(LineGraph);
Legend.DescriptionProperty.OverrideMetadata(thisType, new FrameworkPropertyMetadata("LineGraph"));
Legend.LegendItemsBuilderProperty.OverrideMetadata(thisType, new FrameworkPropertyMetadata(new LegendItemsBuilder(DefaultLegendItemsBuilder)));
}
//more stuff
}发布于 2016-04-04 22:17:54
v0.4.0使用以下语法:
// 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使用了以下语法:
plotter.AddLineGraph(dataSource, pen, marker, new PenDescription("The line label"));发布于 2013-12-03 11:37:00
当您向绘图仪(AddLineGraph(...))添加线条图时,其中一个参数是描述字符串。
发布于 2016-12-08 09:49:32
WGW是现场的!我竖起大拇指。
我发现用一种稍微不同的方式去做更容易理解:
<Page
...
xmlns:d3="http://research.microsoft.com/DynamicDataDisplay/1.0"
... >
...
<Grid Name="GridOne" Grid.Column="0" Grid.Row="0" Margin="13" />
</Page>“守则”的背后是:
using Microsoft.Research.DynamicDataDisplay.Charts;
...
ChartPlotter PlotterOne = new ChartPlotter();
// Add a Graph to One:
GridOne.Children.Add(PlotterOne);
LineGraph line = new LineGraph();
line.ProvideVisiblePoints = true;
line.Stroke = Brushes.Blue;
line.StrokeThickness = 1;
line.DataSource = GetDayDataSource();
Legend.SetDescription(line, "Today's Activity");
PlotterOne.Children.Add(line);希望这能有所帮助。
https://stackoverflow.com/questions/16763989
复制相似问题