Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WPF动态数据显示不显示线图_C#_Wpf_Plot - Fatal编程技术网

C# WPF动态数据显示不显示线图

C# WPF动态数据显示不显示线图,c#,wpf,plot,C#,Wpf,Plot,我已经编写了一个简单的应用程序,我想绘制它计算的一些数据。我在谷歌上遇到了动态数据显示,它看起来正是我需要的那种东西,只是我无法显示绘图 我有以下XAML: <Window ... xmlns:d3="http://research.microsoft.com/DynamicDataDisplay/1.0" ..> <d3:ChartPlotter Name="plotter" Background="Cornsilk" Grid.Row="3" Grid.Column="1

我已经编写了一个简单的应用程序,我想绘制它计算的一些数据。我在谷歌上遇到了
动态数据显示
,它看起来正是我需要的那种东西,只是我无法显示绘图

我有以下XAML:

<Window ... xmlns:d3="http://research.microsoft.com/DynamicDataDisplay/1.0" ..>

<d3:ChartPlotter Name="plotter" Background="Cornsilk" Grid.Row="3" Grid.Column="1">
        <d3:Header>
            <TextBlock HorizontalAlignment="Center" FontSize="20">Very simple chart</TextBlock>
        </d3:Header>
        <d3:HorizontalAxisTitle>This is horizontal axis</d3:HorizontalAxisTitle>
        <d3:VerticalAxisTitle>This is vertical axis</d3:VerticalAxisTitle>
        <d3:Footer>
            <TextBlock HorizontalAlignment="Center" FontSize="10" FontStyle="Italic">
                Footer example
            </TextBlock>
        </d3:Footer>
</d3:ChartPlotter>
当我单击按钮时,绘图右上角会出现一条注释,上面写着
LineGraph
,但没有可见的线条。我很感激你能帮我完成这项工作

更新:

我注意到调试控制台中有以下错误消息:

System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', AncestorLevel='1''. BindingExpression:Path=VerticalContentAlignment; DataItem=null; target element is 'MenuItem' (Name=''); target property is 'VerticalContentAlignment' (type 'VerticalAlignment')

使用ObservedataSource而不是CompositeDataSource。一旦您添加了值,就会引发DataChanged事件,并且图形应该自我更新


我不确定,如果您必须在XAML中添加水平/垂直轴。

这很难帮助您,因为它只是一些第三方库,而不是WPF框架的一部分,他们有一些示例要下载,为什么不复制粘贴线条图示例并在此基础上构建呢我知道这很棘手,我只是希望可能有人对这个库有一些经验,它在谷歌排名很高,而且我确信绘制数据是一项常见的任务。我会把你的意见写在黑板上,然后试着从一个例子中进行分析。
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', AncestorLevel='1''. BindingExpression:Path=VerticalContentAlignment; DataItem=null; target element is 'MenuItem' (Name=''); target property is 'VerticalContentAlignment' (type 'VerticalAlignment')