• 大小: 76KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-02
  • 语言: C#
  • 标签: C#  chart  

资源简介

C#窗口程序chart控件实现动态将数据添加到折线图的功能,勾选框可指示数据是否显示

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Windows.Forms.DataVisualization.Charting;

namespace WindowsFormsApplication2
{
    public partial class Form1 : Form
    {


        private double dm = 0;
        private double vm = 0;         //速度

        private double ss st = 0;        //时间间隔
        private List VM = new List(100);
        private List DM = new List(100);
        private Queue Vm = new Queue(100);
        private Queue Dm = new Queue(100);
        private bool Ready = false;
        private bool contrl = false;

        public Form1()
        {
            InitializeComponent();
        }
        //--------距离监测图表-----------//
        //入口参数:  无                      //
        //                                   //
        private void DistanceData_Line()
        {
            this.chart1.ChartAreas.Clear();
            ChartArea chartarea = new ChartArea(“距离监测“);
            this.chart1.ChartAreas.Add(chartarea);

            chartarea.AxisX.MajorGrid.LineColor = System.Drawing.Color.Transparent;
            chartarea.AxisY.MajorGrid.LineColor = System.Drawing.Color.Black;
            chartarea.AxisX.ScrollBar.Enabled = false;
            //chartarea.AxisY.Minimum = 0;
            //chartarea.AxisY.Maximum = 10000;
            chartarea.AxisX.Interval = 5;
            chartarea.AxisX.MajorGrid.LineColor = System.Drawing.Color.Transparent;
            chartarea.AxisY.MajorGrid.LineColor = System.Drawing.Color.Black;

            //chartarea.AxisX.ScrollBar.Enabled = false;
            //////指当前显示的是第几个           
            //chartarea.AxisX.ScaleView.Size = 10;
            //表头
            this.chart1.titles.Clear();
            this.chart1.titles.Add(“距离监测“);
            this.chart1.titles[0].Text = “距离监测“;
            this.chart1.titles[0].ForeColor = Color.Red;
            this.chart1.titles[0].Font = new System.Drawing.Font(“Microsoft Sans serif“ 12f);

            //定义存储和显示点的容器
            this.chart1.Series.Clear();
            Series series = new Series(“距离“);
            series.ChartType = SeriesChartType.Spline;
            series.ChartArea = “距离监测“;
            series.Color = Color.Yellow;
            series.MarkerBorderWidth = 2;
            series.MarkerSize = 4;
            series.Markerstyle = Markerstyle.Diamond;
            series.ToolTip = “距离“ + “#VAL \r\n #AXISLABEL“;
            chart1.Series.Add(series);

        }


        //--------速度监测图表-----------//
        //入口参数:   无                       //      
        private void VelocityData_Line()
        {

            //定义表区域
            this.chart2.ChartAreas.Clear();
            ChartArea chartarea = new ChartArea(“速度监测“);
     

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      14848  2018-10-24 18:51  动态折线图\WindowsFormsApplication2\bin\Debug\chartaa.exe

     文件      26112  2018-10-24 18:51  动态折线图\WindowsFormsApplication2\bin\Debug\chartaa.pdb

     文件      11600  2018-10-24 18:51  动态折线图\WindowsFormsApplication2\bin\Debug\chartaa.vshost.exe

     文件      14848  2018-10-24 18:47  动态折线图\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.exe

     文件      30208  2018-10-24 18:47  动态折线图\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.pdb

     文件        490  2012-06-06 02:06  动态折线图\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.vshost.exe.manifest

     文件       3775  2018-10-24 17:49  动态折线图\WindowsFormsApplication2\charta.csproj

     文件       9873  2018-10-24 18:47  动态折线图\WindowsFormsApplication2\Form1.cs

     文件       8505  2018-10-24 18:46  动态折线图\WindowsFormsApplication2\Form1.Designer.cs

     文件       6184  2018-10-24 18:46  动态折线图\WindowsFormsApplication2\Form1.resx

     文件        605  2018-10-24 18:51  动态折线图\WindowsFormsApplication2\obj\x86\Debug\charta.csproj.FileListAbsolute.txt

     文件        975  2018-10-24 18:51  动态折线图\WindowsFormsApplication2\obj\x86\Debug\charta.csproj.GenerateResource.Cache

     文件      14848  2018-10-24 18:51  动态折线图\WindowsFormsApplication2\obj\x86\Debug\chartaa.exe

     文件      26112  2018-10-24 18:51  动态折线图\WindowsFormsApplication2\obj\x86\Debug\chartaa.pdb

     文件        180  2018-10-24 18:51  动态折线图\WindowsFormsApplication2\obj\x86\Debug\chartaa.Properties.Resources.resources

     文件       2867  2018-10-24 17:42  动态折线图\WindowsFormsApplication2\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       6482  2018-10-24 18:51  动态折线图\WindowsFormsApplication2\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件       4608  2018-10-24 18:51  动态折线图\WindowsFormsApplication2\obj\x86\Debug\TempPE\Properties.Resources.Designer.cs.dll

     文件        957  2018-10-24 18:50  动态折线图\WindowsFormsApplication2\obj\x86\Debug\WindowsFormsApplication2.csproj.FileListAbsolute.txt

     文件        975  2018-10-24 18:46  动态折线图\WindowsFormsApplication2\obj\x86\Debug\WindowsFormsApplication2.csproj.GenerateResource.Cache

     文件      14848  2018-10-24 18:47  动态折线图\WindowsFormsApplication2\obj\x86\Debug\WindowsFormsApplication2.exe

     文件        180  2018-10-24 18:46  动态折线图\WindowsFormsApplication2\obj\x86\Debug\WindowsFormsApplication2.Form1.resources

     文件      30208  2018-10-24 18:47  动态折线图\WindowsFormsApplication2\obj\x86\Debug\WindowsFormsApplication2.pdb

     文件        180  2018-10-24 17:49  动态折线图\WindowsFormsApplication2\obj\x86\Debug\WindowsFormsApplication2.Properties.Resources.resources

     文件        505  2018-10-24 17:42  动态折线图\WindowsFormsApplication2\Program.cs

     文件       1380  2018-10-24 17:42  动态折线图\WindowsFormsApplication2\Properties\AssemblyInfo.cs

     文件       2854  2018-10-24 18:50  动态折线图\WindowsFormsApplication2\Properties\Resources.Designer.cs

     文件       5612  2018-10-24 17:42  动态折线图\WindowsFormsApplication2\Properties\Resources.resx

     文件       1107  2018-10-24 18:50  动态折线图\WindowsFormsApplication2\Properties\Settings.Designer.cs

     文件        249  2018-10-24 17:42  动态折线图\WindowsFormsApplication2\Properties\Settings.settings

............此处省略14个文件信息

评论

共有 条评论