TeeChart for .NET如何使用函数

本文介绍了TeeChart for .NET如何使用函数,包括添加函数、定义数据源、函数周期和周期样式等。通过实例展示了如何创建和操作函数,如计算平均值和趋势,以及自定义派生函数。TeeChart for .NET是强大的WinForm图表控件,提供全面的功能和易于使用的接口。
摘要由CSDN通过智能技术生成

TeeChart for .NET 是优秀的 4.0 WinForm 图表控件,官方独家授权汉化,集功能全面、性能稳定、价格优惠等优势。NET 的 TeeChart for .NET 中文版承诺让您在使用和学习上没有语言障碍,至少可以节省30%的开发时间。

点击立即下载最新版TeeChart for .NET

功能类型

函数的特点

TeeChart Pro函数是一个系列,几乎可以是任何系列类型,对其应用一个代数函数,其数据源是另一个图表系列。

所有的函数都源自Steema.TeeChart.Functions命名空间中的Function类,并继承Function的Period属性。TeeChart Pro提供了以下预定义函数的列表。

在这里插入图片描述

一些函数类型只支持一个输入系列。然而,可以将函数连锁起来,例如,在你的图表中取几个系列的平均值来创建一个平均函数系列,然后通过使用平均函数作为趋势函数的输入来确定平均值的趋势。

添加一个函数

在TeeChart编辑器中,在 "第一个图表 "页面上,选择 "添加 "按钮,就像在图表中添加一个新系列一样。在TeeChart图库中选择函数标签,选择你需要的函数。每个函数都是以线型系列的形式出现的,你可以通过在第一个图表页面上选择 "改变 "按钮来改变与该函数相关的系列类型。之后在函数系列的数据源页面上可以很容易地改变函数的定义。在这里,你也可以很容易地把你添加到图表中的普通系列的定义改为函数的定义(函数实际上是数据源的定义,而不是系列类型的定义)。

下面的图片显示了编辑函数时的数据源页面。线性系列(标题为 “line2”)已经定义。数据源页面底部的左侧列表框显示了图表中可供输入的其他系列(这里是 “line1”)。

在这里插入图片描述

假设我们从一个完全空白的图表开始,下面是建立一个简单的系列-函数相关图表的代码步骤。
[C#]
private void Form1_Load(object sender, System.EventArgs e)

        //Add a data Series 
        Line line1 = new Line(tChart1.Chart); 

        //Populate it with data (here random) 
        line1.FillSampleValues(10); 

        //Add a series to be used for an Average Function 
        Line line2 = new Line(tChart1.Chart); 

        //Define the Function Type for the new Series 
        Steema.TeeChart.Functions.Average average1 = new Steema.TeeChart.Functions.Average(); 
        line2.Function = average1; 

        //Define the Datasource for the new Function Series 
        line2.DataSource = line1; 

        //*Note - When populating your input Series manually you will need to  
        //use the Checkdatasource method  
        //- See the section entitled 'Defining a Datasource' 
        //Change the Period of the Function so that it groups averages 
        //every 2 Points 
        line2.Function.Period = 2; 
        line2.CheckDataSource(); 

[VB.Net]
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Add a data Series
Dim Line1 As New Steema.TeeChart.Styles.Line(TChart1.Chart)

    'Populate it with data (here random) 
    Line1.FillSampleValues(10) 

    'Add a series to be used for an Average Function 
    Dim Line2 As New Steema.TeeChart.LineSeries(TChart1.Chart) 

    'Define the Function Type for the new Series 
    Dim Average1 As New Steema.TeeChart.Functions.Average() 
    Line2.Function = Average1 

    'Define the Datasource for the new Function Series 
    Line2.DataSource = Line1 

    '*Note - When populating your input Series manually you will need to  
    'use the Checkdatasource method  
    '- See the section entitled 'Defining a Datasource' 
    'Change the Period of the Function so that it groups averages 
    'every 2 Points 
    Line2.Function.Period =
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值