Using Lightningchart to draw curve graphs in C #

Source: Internet
Author: User
Tags ipoint

Recently in a "C # language-based electric furnace temperature control software Design" design, I am not a professional Learning C # language programming in the university, the study of C # is completely in interest, so programming technology is not very strong, encountered problems multi-reference network open source code.

This does not, in doing this topic encountered such a problem, since is to control the electric furnace temperature, can not be separated from the temperature curve of the real-time rendering display, I hope to have a control to complete the curve drawing, searching the network, tried a lot of controls, Also tried the chart control in VisualStudio2015, the effect is not very good. Some netizens said in the panel directly drawline on the line, I feel even more not, CSDN also have small partners to provide the use of PictureBox drawing method, but in my opinion, is still not very ideal. After several searches, we finally found a pretty perfect control: Lightningchart. Next, I use Lightningchart to draw the curve programming idea. Let's have a look at the last one, so that it is not the small partner who wants this effect to find another method: Here we have to mention the advantages of Lightningchart: The curve in the drawing area of the sliding wheel, you can easily zoom in and out of the curve to see the details of the curve, Here is attached backward sliding the mouse wheel after narrowing the curve: With the Lightningchart only to find its strong, is the ideal I want to achieve the effect. Here is the code for the specific drawing curve:

Using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
//Add Reference set
using Arction.WinForms.Charting;
Using Arction.WinForms.Charting.SeriesXY;

Namespace WindowsFormsApplication5
{
Public partial class Form1:form
{
Public Form1 ()
{
Initia Lizecomponent ();
}
//Draw line method
private void Paintline ()
{
Databaseope ope = new Databaseope ();
//disable redraw caused by property change for faster rendering
Lightningchartultimate1.beginupdate ();
//lightningchartultimate1.dock = DockStyle.Fill;
//Add point line series
Pointlineseries pls = new pointlineseries (LIGHTNINGCHARTULTIMATE1.VIEWXY,
Lightningchartultimate1.viewxy.xaxes[0],
Lightningchartultimate1.viewxy.yaxes[0]);
//Display point
pls. Pointsvisible = false;
seriespoint[] apoints = new seriespoint[1000];
for (int iPoint = 0; IPoint < ope. Getxmax () + 1; ipoint++)
{
Apoints[ipoint]. X = (double) iPoint;
Apoints[ipoint]. Y = Ope. Getyvalue (IPoint);
}
//Assign data to the line series
pls. Points = apoints;
//Add point line Series to list
LIGHTNINGCHARTULTIMATE1.VIEWXY.POINTLINESERIES.ADD (pls);
//Allow chart drawing
Lightningchartultimate1.endupdate ();
}

private void Buttongo_click (object sender, EventArgs e)
{
Databaseope ope = new Databaseope ();
Piddeal pid = new Piddeal ();
Lightningchart initialization
LightningChartUltimate1.ViewXY.PointLineSeries.Clear ();
Database initialization: Emptying the database
Ope. Cleardatabase ();
PID Variable Initialization
Pid. Pidinit ();
Pid. SetValue = Double. Parse (Textboxsetvalue.text);
Double p = Double. Parse (Textboxkp.text);
Double i = double. Parse (Textboxki.text);
Double d = Double. Parse (Textboxkd.text);
for (int j = 0;j < 1000;j++)
{
Ope. AddData (J, PID. Pidcontrol (PID. SetValue, p, I, D));
}
Paintline ();
}
}
}

Of course, to achieve the above figure also need to use the database operation and PID algorithm of C # Implementation of the two key points, plus a timer control can also achieve real-time curve drawing, I have realized the real-time curve drawing, but recently there is no time to two fusion, I will put two items are uploaded, you can try , you can make a real-time curve drawing with a slight change. Interested in the small partner can download my uploaded full project file for viewing, rookie, but also look haihan. Attach the resources download link (due to just upload, may still be in the audit status, if the download error also look at a moment to try again):

https://download.csdn.net/download/zpkld123/10309584

Here is to focus on the Lightningchart this control. I was just preliminary in touch with this component, but the power of its capabilities amazed me. Lightningchart is a fast, advanced 2D and 3D chart that supports both the WPF and WinForms platforms and is a. NET component that has received a VisualStudio five-star rating. In addition to the simplest drawing curve function I used above, it has other very powerful features, as shown in: It contains many examples of many kinds of chart drawing, which can be used by the program apes to achieve a variety of data visualization operations. But I do not know why, Lightningchart this powerful. NET component in the network introduction is very few, to me this kind of network to reference the source code of the small white is nowhere to find. Sincerely hope that more and more people use this component, but also hope that the greater God notice this component and upload relevant experience to us this small white reference. Attach lightningchart download Link: http://www.arction.cn/

Using Lightningchart to draw curve graphs in C #

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.