首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >DynamicDataDisplay错误AddLineGraph不在绘图仪中

DynamicDataDisplay错误AddLineGraph不在绘图仪中
EN

Stack Overflow用户
提问于 2016-03-10 06:52:26
回答 4查看 1.2K关注 0票数 1

我一直在使用http://d3future.codeplex.com/中提供的D3版本

它在股票图表上运行良好,但在AddLineGraph上给出了一个错误。下面的代码来自其他网站的帖子。

一些可用的DynamicDataDisplay.dll版本(v2/v3/v4)似乎可以与该语句一起工作/编译。

任何帮助都将不胜感激。

代码语言:javascript
复制
public partial class MainWindow : Window
{
    public ObservableDataSource<Point> source1 = null;
    public MainWindow()
    {
        InitializeComponent();
        //this.Loaded += MainWindow_Loaded;
    }

    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        source1 = new ObservableDataSource<Point>();
        //Set identity mapping of point
        source1.SetXYMapping(p => p);

        plotter3.AddLineGraph(source1, 4, "Data Row");

        //Fits the chart within ViewPort
        plotter3.Viewport.FitToView();

        // Start computation in 2nd thread
        Thread simThread = new Thread(new ThreadStart(Computation));
        simThread.IsBackground = true;
        simThread.Start();
    }
}
EN

回答 4

Stack Overflow用户

发布于 2016-03-10 07:38:55

试试AddLineChart。我不知道它为什么会改变:

代码语言:javascript
复制
var x = Enumerable.Range(0, 9).Select(i => i * 100.0);
var y = new double[] { 10, 9, 7, 8, 5, 6, 4, 3, 2, 1 };
var source = DataSource.Create(x,y);
var line = plotter.AddLineChart(source)
    .WithStroke(Brushes.Red)
    .WithStrokeThickness(2)
    .WithDescription("x vs y");
票数 1
EN

Stack Overflow用户

发布于 2016-03-10 21:19:04

这可能会对你有所帮助,注意这里Point是你Collection中的元素类型,Collection是你的enumerable数据点的集合。

代码语言:javascript
复制
var ds = new EnumerableDataSource<Point>(Collection);
LineGraph line;
ds.SetXMapping(x => x.X);
ds.SetYMapping(y => y.Y);
line = new LineGraph(ds);
line.LinePen = new System.Windows.Media.Pen(System.Windows.Media.Brushes.Red, 2);
//line.Description = new PenDescription("description");
Graph.Children.Add(line);
Graph.FitToView();
票数 0
EN

Stack Overflow用户

发布于 2016-03-13 01:32:15

感谢你们所有的有用的回复。

经过多次修改(是的,我是一个初学者),我发现在项目中添加5个cs文件并使用D3Future源代码站点上提供的DynamicDataDisplay.dll(56kb)可以使代码像最初发布的那样运行。这五个文件是::1 Plotter2D 2 Plotter2DExtensions 3 Description 4 StandardDescription 5 PenDescription

现在我不需要Legends和Description,所以我注释掉了对它们的引用,只是为了让代码用AddLineGraph方法编译和运行。

我使用的是Windows 10/Visual Studio Community Edition 2015。

谢谢。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35904310

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档