C# 顯示圖表數據實例


 1 using System;
 2 using System.Collections.Generic;
 3 using System.ComponentModel;
 4 using System.Data;
 5 using System.Drawing;
 6 using System.Linq;
 7 using System.Text;
 8 using System.Windows.Forms;
 9 using System.Windows.Forms.DataVisualization.Charting;
10 
11 namespace WindowsFormsApplication8
12 {
13     public partial class Form1 : Form
14     {
15         public Form1()
16         {
17             InitializeComponent();
18         }
19 
20         private void Form1_Load(object sender, EventArgs e)
21         {
22             //清除默認的series
23             chart1.Series.Clear();
24             //new 一個叫做【Strength】的系列
25             Series Strength = new Series("力量");
26             Series test = new Series("耐力");
27             test.ChartType = SeriesChartType.Radar;
28             //設置chart的類型,這里為柱狀圖
29             Strength.ChartType = SeriesChartType.Radar;
30             //給系列上的點進行賦值,分別對應橫坐標和縱坐標的值
31             Strength.Points.AddXY("A", "90");
32             Strength.Points.AddXY("B", "88");
33             Strength.Points.AddXY("C", "60");
34             Strength.Points.AddXY("D", "93");
35             Strength.Points.AddXY("E", "79");
36             Strength.Points.AddXY("F", "85");
37             test.Points.AddXY("A", "20");
38             test.Points.AddXY("B", "20");
39             test.Points.AddXY("C", "50");
40             test.Points.AddXY("D", "99");
41             test.Points.AddXY("E", "50");
42             test.Points.AddXY("F", "89");
43 
44             chart1.Series.Add(Strength);
45             chart1.Series.Add(test);
46 
47         }
48     }
49 }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM