■ ColorLine 클래스의 DrawBehind 속성을 사용해 시리즈 뒤에서 그리는 방법을 보여준다.
▶ 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 |
using System.Drawing; using System.Windows.Forms; using Steema.TeeChart.Drawing; using Steema.TeeChart.Styles; using Steema.TeeChart.Tools; namespace TestProject { /// <summary> /// 메인 폼 /// </summary> public partial class MainForm : Form { //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor ////////////////////////////////////////////////////////////////////////////////////////// Public #region 생성자 - MainForm() /// <summary> /// 생성자 /// </summary> public MainForm() { InitializeComponent(); Text = "ColorLine 클래스 : DrawBehind 속성을 사용해 시리즈 뒤에서 그리기"; this.tChart.Panel.Pen = new ChartPen(Color.Black); Points points = new Points(this.tChart.Chart); points.ColorEach = true; points.FillSampleValues(20); Line line = new Line(this.tChart.Chart); line.FillSampleValues(20); double minimum; double maximum; if(line.YValues.Maximum > points.YValues.Maximum) { maximum = line.YValues.Maximum; } else { maximum = points.YValues.Maximum; } if(line.YValues.Minimum > points.YValues.Minimum) { minimum = points.YValues.Minimum; } else { minimum = line.YValues.Minimum; } ColorLine colorLine1 = new ColorLine(this.tChart.Chart); colorLine1.Axis = this.tChart.Axes.Left; colorLine1.Pen.Width = 2; colorLine1.Pen.Color = Color.Red; colorLine1.Value = minimum + ((maximum - minimum) / 2); colorLine1.DrawBehind = true; ColorLine colorLine2 = new ColorLine(this.tChart.Chart); colorLine2.Axis = this.tChart.Axes.Bottom; colorLine2.Pen.Width = 2; colorLine2.Pen.Color = Color.Blue; colorLine2.Value = 10; colorLine2.DrawBehind = true; } #endregion } } |