在网址GitHub下载InteractiveDataDisplay
1 SyncGraphsSample

<Window x:Class="SyncGraphsSample.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:d3="clr-namespace:InteractiveDataDisplay.WPF;assembly=InteractiveDataDisplay.WPF"xmlns:local="clr-namespace:SyncGraphsSample"mc:Ignorable="d"Title="Sync graphs" Height="600" Width="800"><Grid x:Name="LayoutRoot" Background="White"><Grid.RowDefinitions><RowDefinition Height="Auto"/><RowDefinition Height="*"/><RowDefinition Height="5"/><RowDefinition Height="*"/><RowDefinition Height="Auto"/></Grid.RowDefinitions><Grid.ColumnDefinitions><ColumnDefinition Width="Auto"/><ColumnDefinition Width="*"/><ColumnDefinition Width="5"/><ColumnDefinition Width="*"/><ColumnDefinition Width="Auto"/></Grid.ColumnDefinitions><TextBlock Grid.Row="0" Grid.ColumnSpan="4" Text="Syncronized figures sample" TextAlignment="Center" FontSize="18" Margin="5"/><d3:Figure x:Name="leftPlotter" Grid.Row="1" Grid.Column="1" PlotOriginY="{Binding PlotOriginY,ElementName=centerPlotter,Mode=TwoWay}" PlotHeight="{Binding PlotHeight,ElementName=centerPlotter,Mode=TwoWay}"><d3:PlotAxis AxisOrientation="Left" d3:Figure.Placement="Left"/><d3:PlotAxis AxisOrientation="Top" d3:Figure.Placement="Top"/><d3:CircleMarkerGraph x:Name="circles"/><d3:MouseNavigation/><Border BorderThickness="0.5" BorderBrush="Black"/></d3:Figure><d3:Figure x:Name="centerPlotter" Grid.Column="3" Grid.Row="1"><d3:PlotAxis AxisOrientation="Right"  d3:Figure.Placement="Right"/><d3:PlotAxis AxisOrientation="Top" d3:Figure.Placement="Top"/><d3:LineGraph x:Name="lineGraph1"/><d3:MouseNavigation/><Border BorderThickness="0.5" BorderBrush="Black"/></d3:Figure><d3:Figure x:Name="bottomPlotter" Grid.Column="3" Grid.Row="3" PlotOriginX="{Binding PlotOriginX,ElementName=centerPlotter,Mode=TwoWay}" PlotWidth="{Binding PlotWidth,ElementName=centerPlotter,Mode=TwoWay}"><d3:PlotAxis AxisOrientation="Right"  d3:Figure.Placement="Right"/><d3:PlotAxis AxisOrientation="Bottom"  d3:Figure.Placement="Bottom"/><d3:MouseNavigation/><d3:BarGraph x:Name="barGraph"/><Border BorderThickness="0.5" BorderBrush="Black"/></d3:Figure><ContentControl Grid.Column="1" Grid.Row="3" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Margin="20,20,20,20"><TextBlock FontSize="14" TextWrapping="Wrap" TextAlignment="Center" >These three Charts have shared axes. Two of the sharevertical axis, two - horizontal. Navigate in one plot and see how other is changed. This is done purely in XAML.</TextBlock></ContentControl></Grid>
</Window>
using System;
using System.Linq;
using System.Windows;
using System.Windows.Media;namespace SyncGraphsSample
{/// <summary>/// Interaction logic for MainWindow.xaml/// </summary>public partial class MainWindow : Window{public MainWindow(){InitializeComponent();barGraph.PlotBars(Enumerable.Range(1, 10));int N = 25;Random r = new Random();double[] x = new double[N];double[] y = new double[N];for (int i = 0; i < N; i++){x[i] = r.NextDouble() * 12 - 1;y[i] = r.NextDouble() * 12 - 1;}circles.PlotXY(x, y);double[] x1 = Enumerable.Range(0, 90).Select(i => i / 10.0).ToArray();double[] y1 = x1.Select(v => 7 * (Math.Abs(v) < 1e-10 ? 1 : Math.Sin(v) / v) + 1).ToArray();lineGraph1.Stroke = new SolidColorBrush(Colors.Green);lineGraph1.StrokeThickness = 2.0;lineGraph1.Plot(x1, y1);}}
}

2.LineGraphSample

<Window x:Class="LineGraphSample.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:d3="clr-namespace:InteractiveDataDisplay.WPF;assembly=InteractiveDataDisplay.WPF"xmlns:local="clr-namespace:LineGraphSample"mc:Ignorable="d"Title="Line graph" Height="600" Width="800"><Window.Resources><local:VisibilityToCheckedConverter x:Key="VisibilityToCheckedConverter"/></Window.Resources><Grid x:Name="LayoutRoot" Background="White"><d3:Chart Name="plotter" IsXAxisReversed="True"><d3:Chart.Title><TextBlock HorizontalAlignment="Center" FontSize="18" Margin="0,5,0,5">Line graph legend sample</TextBlock></d3:Chart.Title><d3:Chart.LegendContent><d3:LegendItemsPanel><d3:LegendItemsPanel.Resources><DataTemplate x:Key="InteractiveDataDisplay.WPF.LineGraph"><StackPanel Orientation="Horizontal"><CheckBox IsChecked="{Binding Path=Visibility, Converter={StaticResource VisibilityToCheckedConverter}, Mode=TwoWay}"/><Line Width="15" Height="15" X1="0" Y1="0" X2="15" Y2="15" Stroke="{Binding Path=Stroke}" StrokeThickness="2"/><TextBlock Margin="5,0,0,0" Text="{Binding Path=Description}"/></StackPanel></DataTemplate></d3:LegendItemsPanel.Resources></d3:LegendItemsPanel></d3:Chart.LegendContent><Grid Name="lines"/></d3:Chart></Grid>
</Window>
 public partial class MainWindow : Window{public MainWindow(){InitializeComponent();double[] x = new double[200];for (int i = 0; i < x.Length; i++)x[i] = 3.1415 * i / (x.Length - 1);for (int i = 0; i < 25; i++){var lg = new LineGraph();lines.Children.Add(lg);lg.Stroke = new SolidColorBrush(Color.FromArgb(255, 0, (byte)(i * 10), 0));lg.Description = String.Format("Data series {0}", i + 1);lg.StrokeThickness = 2;lg.Plot(x, x.Select(v => Math.Sin(v + i / 10.0)).ToArray());}}}public class VisibilityToCheckedConverter : IValueConverter{public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture){return ((Visibility)value) == Visibility.Visible;}public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture){return ((bool)value) ? Visibility.Visible : Visibility.Collapsed;}}

3.BarChartSample

<Window x:Class="BarChartSample.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:d3="clr-namespace:InteractiveDataDisplay.WPF;assembly=InteractiveDataDisplay.WPF"mc:Ignorable="d"Title="Bar chart" Height="600" Width="800"><Grid><d3:Chart Name="plotter"><d3:Chart.Title><TextBlock HorizontalAlignment="Center" FontSize="18" Margin="0,5,0,5">Bar chart sample</TextBlock></d3:Chart.Title><d3:BarGraph Name="barChart" Color="Blue"/></d3:Chart></Grid>
</Window>
 public MainWindow(){InitializeComponent();int N = 100;double[] y = new double[N];Random r = new Random();double k;for (int i = 0; i < N; i++){k = r.NextDouble();y[i] = k < 0.5 ? r.Next(100) : -r.Next(100);}barChart.PlotBars(y);}

更多案例可以访问GitHub

WPF中使用InteractiveDataDisplay控件画图相关推荐

  1. 在WPF中使用WinForm控件方法

    在WPF中使用WinForm控件方法 原文:在WPF中使用WinForm控件方法 1.      首先添加对如下两个dll文件的引用:WindowsFormsIntegration.dll,Syste ...

  2. 如何在wpf中使用winform控件或者winform的自定义控件

    前言 在wpf中使用winform控件或者winform的自定义控件 一.添加引用 WindowsFormsIntegration.dll System.Windows.Forms.dll 提示:这两 ...

  3. 如何在WPF中使用Winform控件

    要在WPF中使用WInform组件,必须将WInform组件放在宿主WindowsFormsHost中. WindowsFormsHost是WPF的一个控件,它允许在WPF应用程序中托管Windows ...

  4. 如何在WPF中调用Winform控件

    功能实现主要分三步: 1.添加两个引用:WindowsFormsIntegration.dll (负责整合WPF和Windows).System.Windows.Forms. 2.在 XAML文件中添 ...

  5. WPF中使用Winform控件

    在项目中遇到使用WPF做上位机,引用Winform控件,特此做一下总结: 1.在设计界面添加: xmlns:wf="clr-namespace:System.Windows.Forms;as ...

  6. WPF中使用浏览器控件WebBrowser

    设置使用IE的版本 public static class Extensions{#region 设置WebBroswer 使用IE版本public static void SetWebBrowser ...

  7. 【柏拉图】在WPF中利用DevExpress控件进行柏拉图展示

    dx控件版本为15.2 因为17.2在win7系统中可能存在报错 有知道原因的大佬烦请告知一下 <Grid Grid.Column="1"><dxc:ChartC ...

  8. 如何在WPF中调用C#控件库(HexEdit)

    1 编写一个Hex Edit控件,使用VS2010建立一个类控件库,分别增加两个类文件,一个命名为HexEdit.cs, 一个命名为TextEditControl.cs,具体内容如下所示: 1)Hex ...

  9. WPF中得到一个控件相对其他控件的坐标

    加入想得到按钮btnTest左上角相对于主窗体winTest的坐标,可以用如下方法: btnTest.TranslatePoint(new Point(0, 0), winTest) 这个方法返回一个 ...

最新文章

  1. 程序员:我不学Python了!!
  2. 卢京潮自动控制原理ppt_视觉定位系统在贴片机中的使用与原理作用
  3. IDC:以太网交换机市场增长2%
  4. PAT甲级1100 Mars Numbers:[C++题解]进制位、使用stringstream类读入
  5. 修改Git提交者昵称和邮箱
  6. ITK:将标量映射到Jet Colormap中
  7. %matplotlib inline 的作用
  8. ADO.NET连接数据库
  9. 6月开招|工业互联才是王道,最高可达50k!
  10. 计算机二级考试都怎么考,计算机二级都考什么 怎么考
  11. Vue (响应式原理-模拟-2-Observer)
  12. 传输层端口号的范围是多少?被分为哪两部分_根据资金习性可以把资金分为哪几类?_中级会计职称考试视频...
  13. tomcat等web服务器的工作原理
  14. nodejs升级命令_又一阵后浪:横空出世的Deno会取代NodeJS吗?
  15. OSPF基础配置命令
  16. 【前端静态资源托管库-CDN】BootCDN资源全线失效
  17. 【OpenCV】 - 图像分割之分水岭算法,watershed()函数的输出,对marker和image的改变
  18. iTextSharp 使用详解(转) 感谢原著作者
  19. CSP-J2022入门组二轮补赛试题(山东)T2:宴会
  20. Sonic常见问题解决方法之——设备中心出现多个iOS设备接入异常

热门文章

  1. 2013年最忧伤的句子
  2. python+selenium实现自动刷新网页
  3. 【转】全国各地做生意十年的心得,忍不住上来感慨一下,诚信才是根基!
  4. 网页中打开pdf、doc、ppt、xsl、sxw、ods、odp相关代码
  5. PHP面试题(个人总结)————(暂不更新)
  6. 别了,开拓者的小伙们!
  7. 为PostgreSQL配置work_mem
  8. 服务器配置mysql
  9. 商业智能在医疗卫生领域的应用与前景
  10. 个人云盘、企业云盘傻傻分不清楚?3分钟带你清晰两者差异!