WPF学习(4)--SCICHART学习

一、项目创建过程

1.下载SCICHART插件

2.选中第一个,确保引用中有我们要用的

二、示例代码

1.前端代码

XML 复制代码
<Window x:Class="SciChart.Examples.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:s="http://schemas.abtsoftware.co.uk/scichart">

    <Grid>
        <s:SciChartSurface x:Name="sciChart">
            <s:SciChartSurface.RenderableSeries>
                <s:FastLineRenderableSeries x:Name="lineSeries">
                    <s:FastLineRenderableSeries.DataSeries>
                        <!-- 使用正确的数据系列类型 -->
                        <s:XyDataSeries x:Name="dataSeries"/>
                    </s:FastLineRenderableSeries.DataSeries>
                </s:FastLineRenderableSeries>
            </s:SciChartSurface.RenderableSeries>
        </s:SciChartSurface>
    </Grid>
</Window>

2.后端代码

cs 复制代码
using System;
using System.Windows;
using SciChart.Charting.Model.DataSeries;

namespace SciChart.Examples
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            Loaded += MainWindow_Loaded;
        }

        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            // 示例数据系列
            var rand = new Random();
            var dataSeries = new XyDataSeries<DateTime, double>();

            // 生成随机数据
            for (int i = 0; i < 100; i++)
            {
                dataSeries.Append(DateTime.Now.AddDays(i), rand.NextDouble() * 100);
            }

            // 将数据系列赋给渲染系列
            lineSeries.DataSeries = dataSeries;

            // 可选:自动调整视图范围
            sciChart.ZoomExtents();
        }
    }
}

3.曲线

相关推荐
hez20101 天前
Runtime Async - 步入高性能异步时代
c#·.net·.net core·clr
mudtools1 天前
.NET驾驭Word之力:玩转文本与格式
c#·.net
唐青枫2 天前
C#.NET 数据库开发提速秘籍:SqlSugar 实战详解
c#·.net
mudtools2 天前
.NET驾驭Word之力:理解Word对象模型核心 (Application, Document, Range)
c#·.net
大飞pkz3 天前
【设计模式】C#反射实现抽象工厂模式
设计模式·c#·抽象工厂模式·c#反射·c#反射实现抽象工厂模式
唐青枫3 天前
从入门到进阶:C#.NET Stopwatch 计时与性能测量全攻略
c#·.net
未来之窗软件服务3 天前
幽冥大陆(二)RDIFSDK 接口文档:布草洗涤厂高效运营的技术桥梁C#—东方仙盟
开发语言·c#·rdif·仙盟创梦ide·东方仙盟
1uther3 天前
Unity核心概念⑨:Screen
开发语言·游戏·unity·c#·游戏引擎
阿幸软件杂货间3 天前
Office转PDF转换器v1.0.py
开发语言·pdf·c#
sali-tec3 天前
C# 基于halcon的视觉工作流-章34-环状测量
开发语言·图像处理·算法·计算机视觉·c#