■ Cumulative 클래스를 사용해 데이터 소스 포인트 값의 증분 합계를 계산하는 방법을 보여준다.
▶ MainForm.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
using System.Drawing; using System.Windows.Forms; using Steema.TeeChart.Functions; using Steema.TeeChart.Styles; namespace TestProject { /// <summary> /// 메인 폼 /// </summary> public partial class MainForm : Form { //////////////////////////////////////////////////////////////////////////////////////////////////// Field ////////////////////////////////////////////////////////////////////////////////////////// Private #region Field /// <summary> /// 막대 시리즈 /// </summary> private Bar bar; /// <summary> /// 누적 함수 /// </summary> private Cumulative cumulative; /// <summary> /// 라인 시리즈 /// </summary> private Line line; #endregion //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor ////////////////////////////////////////////////////////////////////////////////////////// Public #region 생성자 - MainForm() /// <summary> /// 생성자 /// </summary> public MainForm() { InitializeComponent(); #region 막대 시리즈를 생성한다. this.bar = new Bar(); this.bar.Title = "Source"; this.bar.Brush.Color = Color.FromArgb(68, 102, 163); this.bar.Color = Color.FromArgb(68, 102, 163); #endregion #region 누적 함수를 생성한다. this.cumulative = new Cumulative(); this.cumulative.Period = 1d; #endregion #region 라인 시리즈를 생성한다. this.line = new Line(); this.line.Title = "Cumulative"; this.line.Brush.Color = Color.FromArgb(243, 156, 53); this.line.Color = Color.FromArgb(243, 156, 53); this.line.Pointer.Brush.Color = Color.FromArgb(255, 255, 255); this.line.Marks.Brush.Color = Color.FromArgb(0, 128, 0); this.line.Marks.Brush.Visible = true; this.line.Marks.Pen.Color = Color.Orange; this.line.Marks.Font.Brush.Color = Color.White; this.line.Marks.Visible = true; this.line.DataSource = this.bar; this.line.Function = this.cumulative; #endregion #region 티차트를 설정한다. this.tChart.Series.Add(this.bar); this.tChart.Series.Add(this.line); #endregion this.bar.Add(new int[10] { 7, 5, 6, 8, 2, 1, 9, 3, 4, 1 }); this.line.CheckDataSource(); } #endregion } } |