첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

TestProject.zip
0.01MB

▶ MainForm.cs

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 클래스 : DragRepaint 속성을 사용해 드래그시 차트 다시 그리기";

            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.DragRepaint = 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.DragRepaint = true;
        }

        #endregion
    }
}

※ 색상 라인 드래그시 DragRepaint 속성이 false인 경우 잔상이 보이나 true인 경우 잔상이 보이지 않는다.

728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요