InteractiveDataDisplay是Microsoft开发的一组 WPF 控件,用于在 WPF 应用程序中交互式显示数据。它支持折线图、气泡图、热图和其他在科学软件中非常常见的复杂二维图。GitHub 页面上的最后一次提交是从 2018 年开始的,最后一次发布的 NuGet 包InteractiveDataDisplay.WPF是从 2017 年开始的,所以这个项目似乎不再维护

平台支持

官方包只支持.NET Framework: NuGet包(1.0.0版)不支持.NET Core。更具体地说,NuGet 包具有复杂的过时依赖项,而官方 NuGet 包仅适用于开箱即用的.NET Framework 4.5.2

对 .NET Core 的非官方支持: 2019 年的第34期链接到Jeff Mastry的支持 .NET Core 的分支,但它在 NuGet 上不可用,并且微软从未对此问题作出回应。

互动性

  • 左键单击拖动以平移
  • 左键单击并拖动轴以平移该轴
  • 滚轮缩放
  • 双击以使轴限制适合数据

快速开始

  1. 创建 .NET Framework WPF 应用程序
  2. 添加InteractiveDataDisplay.WPFNuGet 包
  3. 将图表控件添加到您的布局
  4. Add()图表类型

主窗口.xaml

<Window x:Class="QuickstartInteractiveDataDisplay.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:local="clr-namespace:QuickstartInteractiveDataDisplay" xmlns:d3="clr-namespace:InteractiveDataDisplay.WPF;assembly=InteractiveDataDisplay.WPF"mc:Ignorable="d"Title="MainWindow" Height="450" Width="800"><Grid><d3:Chart Name="myChart"><Grid Name="myGrid"/></d3:Chart></Grid>
</Window>

生成样本数据

此代码生成我们可以练习绘图的随机数据

private Random rand = new Random(0);
private double[] RandomWalk(int points = 5, double start = 100, double mult = 50)
{// return an array of difting random numbersdouble[] values = new double[points];values[0] = start;for (int i = 1; i < points; i++)values[i] = values[i - 1] + (rand.NextDouble() - .5) * mult;return values;
}
private double[] Consecutive(int points, double offset = 0, double stepSize = 1)
{// return an array of ascending numbers starting at 1double[] values = new double[points];for (int i = 0; i < points; i++)values[i] = i * stepSize + 1 + offset;return values;
}

条状图

// generate some random Y data
int pointCount = 5;
double[] xs1 = Consecutive(pointCount, offset: 0);
double[] xs2 = Consecutive(pointCount, offset: .4);
double[] ys1 = RandomWalk(pointCount);
double[] ys2 = RandomWalk(pointCount);// create the series and describe their styling
var bar1 = new InteractiveDataDisplay.WPF.BarGraph()
{Color = Brushes.Blue,Description = "Group A",BarsWidth = .35,
};var bar2 = new InteractiveDataDisplay.WPF.BarGraph()
{Color = Brushes.Red,Description = "Group B",BarsWidth = .35,
};// load data into each series
bar1.PlotBars(xs1, ys1);
bar2.PlotBars(xs2, ys2);// add the series to the grid
myGrid.Children.Clear();
myGrid.Children.Add(bar1);
myGrid.Children.Add(bar2);// customize styling
myChart.Title = $"Bar Graph";
myChart.BottomTitle = $"Horizontal Axis Label";
myChart.LeftTitle = $"Vertical Axis Label";
myChart.IsAutoFitEnabled = false;
myChart.LegendVisibility = Visibility.Visible;// set axis limits manually
myChart.PlotOriginX = .5;
myChart.PlotWidth = 5.5;
myChart.PlotOriginY = 0;
myChart.PlotHeight = 200;

散点图

// generate some random X and Y data
int pointCount = 500;
double[] xs1 = RandomWalk(pointCount);
double[] ys1 = RandomWalk(pointCount);
double[] xs2 = RandomWalk(pointCount);
double[] ys2 = RandomWalk(pointCount);
double[] sizes = Consecutive(pointCount, 10, 0);// create the lines and describe their styling
var line1 = new InteractiveDataDisplay.WPF.CircleMarkerGraph()
{Color = new SolidColorBrush(Colors.Blue),Description = "Group A",StrokeThickness = 1
};var line2 = new InteractiveDataDisplay.WPF.CircleMarkerGraph()
{Color = new SolidColorBrush(Colors.Red),Description = "Group B",StrokeThickness = 1
};// load data into the lines
line1.PlotSize(xs1, ys1, sizes);
line2.PlotSize(xs2, ys2, sizes);// add lines into the grid
myGrid.Children.Clear();
myGrid.Children.Add(line1);
myGrid.Children.Add(line2);// customize styling
myChart.Title = $"Line Plot ({pointCount:n0} points each)";
myChart.BottomTitle = $"Horizontal Axis Label";
myChart.LeftTitle = $"Vertical Axis Label";
myChart.IsAutoFitEnabled = true;
myChart.LegendVisibility = Visibility.Hidden;

线图

我可以显示大约 10 万行点的行,性能开始受到很大影响。

int pointCount = 10_000;
double[] xs = Consecutive(pointCount);
double[] ys1 = RandomWalk(pointCount);
double[] ys2 = RandomWalk(pointCount);// create the lines and describe their styling
var line1 = new InteractiveDataDisplay.WPF.LineGraph
{Stroke = new SolidColorBrush(Colors.Blue),Description = "Line A",StrokeThickness = 2
};var line2 = new InteractiveDataDisplay.WPF.LineGraph
{Stroke = new SolidColorBrush(Colors.Red),Description = "Line B",StrokeThickness = 2
};// load data into the lines
line1.Plot(xs, ys1);
line2.Plot(xs, ys2);// add lines into the grid
myGrid.Children.Clear();
myGrid.Children.Add(line1);
myGrid.Children.Add(line2);// customize styling
myChart.Title = $"Line Plot ({pointCount:n0} points each)";
myChart.BottomTitle = $"Horizontal Axis Label";
myChart.LeftTitle = $"Vertical Axis Label";
myChart.IsAutoFitEnabled = true;
myChart.LegendVisibility = Visibility.Visible;

WPF免费绘图库推荐相关推荐

  1. 学习之路/免费的图库推荐

    2019独角兽企业重金招聘Python工程师标准>>> 免费的图库推荐 欢迎阅读我所有的学习之路系列文章: 学习之路系类文章目录 本文会根据我在实际使用中,用到的一些免费图库,推荐给 ...

  2. 开源项目推荐:OpenGL/Vulkan/Cairo/Skia/angle/VTK/OpenVG/MyPaint/GIMP/Krita/Pencil2D/inkspace/enve等绘图库或画图软件

    绘图引擎简介 Windows环境下二维绘图引擎有多种选择:GDI.GDI+.DirectDraw.Qt/QPainter.Agg.Cairo.skia.Direct2D.Direct3D.OpenGL ...

  3. 推荐一个很棒的JS绘图库Flot

    Flot是Ole Laursen开发的基于JQuery的纯JavaScript实现的绘图库,Flot使用起来非常简单,绘图效果相当绚丽,而且还支持一些图片的操作功能,例如图片的缩放.可以看一下Flot ...

  4. 这是一款功能强大的开源 Python 绘图库

    今天给大家分享一篇可视化干货,介绍的是功能强大的开源 Python 绘图库 Plotly,教你如何用超简单的(甚至只要一行!)代码,绘制出更棒的图表. 我之前一直守着 matplotlib 用的原因, ...

  5. 文末送书 | 手把手教你玩转,Python 会交互的超强绘图库 Plotly!

    作者:Will Koehrsen,译者:欧剃,编辑:肉松 原文:https://towardsdatascience.com/the-next-level-of-data-visualization- ...

  6. 功能强大、文档健全的开源 Python 绘图库 Plotly,手把手教你用!

    公众号 "菜鸟学Python", 设为 "星标" 和30w+一起学Python! 译者:欧剃 https://towardsdatascience.com/th ...

  7. matplotlib绘图库入门

    2019独角兽企业重金招聘Python工程师标准>>> matplotlib 是python最著名的绘图库,它提供了一整套和matlab相似的命令API,十分适合交互式地行制图.而且 ...

  8. python画画用哪库好_小白开始学Python最著名的绘图库

    原标题:小白开始学Python最著名的绘图库 这是菜鸟学Python的第101篇原创文章 数据分析里面可视化是重要的环节,辛苦把数据采集,然后经历了很多工序的清洗之后,最后要展现给用户,最好的方法就是 ...

  9. python绘图库seaborn_Matplotlib Toolkits:python高级绘图库seaborn

    Seaborn介绍 seaborn (Not distributed with matplotlib) seaborn is a highlevel interface for drawing sta ...

最新文章

  1. 通过gdb core dump方法查看程序异常时的堆栈信息
  2. Spark 应用程序调优
  3. Kamailio v4.4.6 发布,开源 SIP 服务器
  4. javascript 常用方法
  5. MVC高级编程-目录
  6. 请别埋没了URL Routing
  7. JNDI数据源的使用
  8. 【论文相关】盘点AAAI2020中的四篇推荐系统好文
  9. 网络信息系统(NIS服务器)
  10. C语言 for 循环 - C语言零基础入门教程
  11. C++编译问题-检测到 Mac 文件格式: 请将源文件转换为 DOS 格式或 UNIX 格式
  12. 小米回应“上海徐汇拿地”:不用于造车
  13. java ee 员工管理系统,fb3492 javaEE_原生Servlet_MySql企业员工信息管理系统的设计与实现,java源码含论文与答辩PPT...
  14. java jni编译_从源码编译Android系统的Java类库和JNI动态库的方法
  15. OPPO Reno6系列和Reno5系列有啥区别?价格差不多?
  16. [渝粤教育] 中国地质大学 微积分(二) 复习题 (2)
  17. 大数据工作由哪几部分组成
  18. maven teavm-idea-artifacts: Command execution failed.: Process exited with an error: 1 Exit value: 1
  19. onenote打开闪退平板_轻松解决Win10 OneNote打不开或闪退的问题
  20. Python得到前面12个月的数据

热门文章

  1. 自定义注解+切面处理+全局异常处理
  2. 注销苹果id 显示联系服务器时出现问题,帮您还原连接appleid服务器时出错 【图文介绍】的处理办法_...
  3. opencv画框显示python_python+opencv选出视频中一帧再利用鼠标回调实现图像上画矩形框...
  4. python爬虫爬拼多多销量_Python爬取各大汽车销量信息
  5. 实现css六边形边框,css 这种六边形的边框怎么画?
  6. av_dump_format函数使用说明
  7. 数据中心双活该如何构建
  8. 暴力递归到动态规划 05 (贴纸拼词)
  9. 非监督神经网络的wake-sleep算法
  10. JAVA 8 lambda 表达式实现按某个属性值查找对象集合中符合条件的对象