■ Line 클래스의 GetSeriesMark 이벤트를 사용해 커스텀 시리즈 마크를 설정하는 방법을 보여준다.
▶ 예제 코드 (C#)
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 |
using System; using System.Drawing; using Steema.TeeChart; using Steema.TeeChart.Styles; TChart chart = new TChart(); chart.Aspect.View3D = false; Random random = new Random(); Line line = new Line(); line.Marks.Visible = true; line.GetSeriesMark += line_GetSeriesMark; line.XValues.DateTime = true; line.Pointer.Visible = true; line.HorizAxis = HorizontalAxis.Top; line.Add(DateTime.Parse("2002/12/25 10:30:00"), random.Next(100), "", Color.Red); line.Add(DateTime.Parse("2002/12/25 22:30:00"), random.Next(100), "", Color.Red); line.Add(DateTime.Parse("2002/12/26 09:20:00"), random.Next(100), "", Color.Red); line.Add(DateTime.Parse("2002/12/26 23:30:00"), random.Next(100), "", Color.Red); line.Add(DateTime.Parse("2002/12/27 11:10:00"), random.Next(100), "", Color.Red); line.Add(DateTime.Parse("2002/12/27 20:15:00"), random.Next(100), "", Color.Red); line.Add(DateTime.Parse("2002/12/28 08:15:00"), random.Next(100), "", Color.Red); line.Add(DateTime.Parse("2002/12/28 21:45:00"), random.Next(100), "", Color.Red); line.Add(DateTime.Parse("2002/12/29 12:45:00"), random.Next(100), "", Color.Red); line.Add(DateTime.Parse("2002/12/29 22:05:00"), random.Next(100), "", Color.Red); chart.Series.Add(line); #region 라인 시리즈 마크 구하기 - line_GetSeriesMark(sender, e) /// <summary> /// 라인 시리즈 마크 구하기 /// </summary> /// <param name="sender">이벤트 발생자</param> /// <param name="e">이벤트 인자</param> private void line_GetSeriesMark(Series sender, GetSeriesMarkEventArgs e) { Line line = sender as Line; if(e.ValueIndex > 0) { if(line.YValues[e.ValueIndex] > line.YValues[e.ValueIndex - 1]) { e.MarkText = e.MarkText + " (Up)"; } else if(line.YValues[e.ValueIndex] < line.YValues[e.ValueIndex - 1]) { e.MarkText = e.MarkText + " (Down)"; } else { e.MarkText = e.MarkText + " (No Change)"; } } } #endregion |