领导要求写一个数据分析软件,特点是数据量超级大,要求是快速准确绘图。
接下来给大家看一下Scichart强大的存在。
- 先安装Scichart控件
下载地址:https://download.csdn.net/download/qq_41270634/12277623
- 我们打开软件看一看
- 选择我们需要的2D Scatter Chart 图表
- 我们来看下他的Source Code (前端)
<UserControl x:Class="SciChart.Examples.Examples.CreateSimpleChart.ScatterChartExampleView" 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:ext="http://schemas.abtsoftware.co.uk/scichart/exampleExternals" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:s="http://schemas.abtsoftware.co.uk/scichart" d:DesignHeight="400" d:DesignWidth="600" Loaded="ScatterChartExampleView_Loaded" mc:Ignorable="d">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ext:SciChartInteractionToolbar TargetSurface="{Binding Source={x:Reference Name=sciChart}}"/>
<!-- Create the chart surface -->
<s:SciChartSurface Name="sciChart" Grid.Column="1" Padding="0" BorderThickness="0">
<!-- Declare RenderableSeries -->
<s:SciChartSurface.RenderableSeries>
<s:XyScatterRenderableSeries x:Name="scatterRenderSeries">
<s:XyScatterRenderableSeries.PointMarker>
<s:EllipsePointMarker Width="9" Height="9" Fill="SteelBlue" Stroke="LightSteelBlue" StrokeThickness="2"/>
</s:XyScatterRenderableSeries.PointMarker>
<s:XyScatterRenderableSeries.SeriesAnimation>
<s:ScaleAnimation AnimationDelay="0:0:1" Duration="0:0:2"/>
</s:XyScatterRenderableSeries.SeriesAnimation>
</s:XyScatterRenderableSeries>
</s:SciChartSurface.RenderableSeries>
<!-- Create an X Axis with Growby -->
<s:SciChartSurface.XAxis>
<s:NumericAxis DrawMajorBands="True" GrowBy="0.1, 0.1"/>
</s:SciChartSurface.XAxis>
<!-- Create a Y Axis with Growby. Optional bands give a cool look and feel for minimal performance impact -->
<s:SciChartSurface.YAxis>
<s:NumericAxis DrawMajorBands="True" GrowBy="0.1, 0.1"/>
</s:SciChartSurface.YAxis>
</s:SciChartSurface>
</Grid>
</UserControl>
- 我们来看下他的Source Code (后端)
using System.Windows.Controls;
using SciChart.Charting.Model.DataSeries;
using SciChart.Examples.ExternalDependencies.Data;
namespace SciChart.Examples.Examples.CreateSimpleChart
{
///<summary>
/// Interaction logic for ScatterChartExampleView.xaml
///</summary>
public partial class ScatterChartExampleView : UserControl
{
public ScatterChartExampleView()
{
InitializeComponent();
}
private void ScatterChartExampleView_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
// Create a dataseries of type X=double, Y=double
var dataSeries = new XyDataSeries<double, double>();
var data = DataManager.Instance.GetDampedSinewave(1.0, 0.02, 200);
// Append data to series. SciChart automatically redraws
dataSeries.Append(data.XData, data.YData);
scatterRenderSeries.DataSeries = dataSeries;
sciChart.ZoomExtents();
}
}
}
- 我们参考他的代码,先复制过来 前后端
我们还需要添加引用库.dll 路径在安装文件夹下的Lib文件夹下选择对应的.net
我添加了
- 这是我们就可以运行程序了,就会显示出和scichart一样的散点图
- 给大家看下我修改后运行大量数据的散点图
- 控件直接支持放大和缩小,一直选择区域进行放大