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

TestProject.zip
0.01MB

▶ MainForm.cs

using System;
using System.Drawing;
using System.Windows.Forms;

using Steema.TeeChart.Drawing;
using Steema.TeeChart.Styles;

namespace TestProject
{
    /// <summary>
    /// 메인 폼
    /// </summary>
    public partial class MainForm : Form
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Field
        ////////////////////////////////////////////////////////////////////////////////////////// Private

        #region Field

        /// <summary>
        /// 포인트 시리즈
        /// </summary>
        private Points points;

        #endregion

        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 생성자 - MainForm()

        /// <summary>
        /// 생성자
        /// </summary>
        public MainForm()
        {
            InitializeComponent();

            Text = "Points 클래스 : GetVertAxis 필드를 사용해 Y축 설정하기";

            this.treatNullsComboBox.DropDownStyle = ComboBoxStyle.DropDownList;

            this.treatNullsComboBox.Items.Add(TreatNullsStyle.DoNotPaint);
            this.treatNullsComboBox.Items.Add(TreatNullsStyle.Ignore    );
            this.treatNullsComboBox.Items.Add(TreatNullsStyle.Skip      );

            this.treatNullsComboBox.SelectedIndex = 0;

            this.tChart.Panel.Pen = new ChartPen(Color.Black);

            this.points = new Points(this.tChart.Chart);

            this.points.TreatNulls = TreatNullsStyle.DoNotPaint;

            this.points.FillSampleValues(100);

            Random random = new Random();

            for(int i = 0; i < 30; i++)
            {
                int index = random.Next(0, 99);

                points.SetNull(index);
            }

            this.treatNullsComboBox.SelectedIndexChanged      += treatNullsComboBox_SelectedIndexChanged;
            this.automaticVerticalAxisCheckBox.CheckedChanged += automaticVerticalAxisCheckBox_CheckedChanged;
        }

        #endregion

        //////////////////////////////////////////////////////////////////////////////////////////////////// Method
        ////////////////////////////////////////////////////////////////////////////////////////// Private
        //////////////////////////////////////////////////////////////////////////////// Event

        #region NULL 처리 콤보 박스 선택 인덱스 변경시 처리하기 - treatNullsComboBox_SelectedIndexChanged(sender, e)

        /// <summary>
        /// NULL 처리 콤보 박스 선택 인덱스 변경시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void treatNullsComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            TreatNullsStyle style = (TreatNullsStyle)this.treatNullsComboBox.SelectedItem;

            this.points.TreatNulls = style;

            this.tChart.Refresh();
        }

        #endregion
        #region 자동 수직 축 체크 박스 체크 변경시 처리하기 - automaticVerticalAxisCheckBox_CheckedChanged(sender, e)

        /// <summary>
        /// 자동 수직 축 체크 박스 체크 변경시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void automaticVerticalAxisCheckBox_CheckedChanged(object sender, EventArgs e)
        {
            this.points.GetVertAxis.Automatic = this.automaticVerticalAxisCheckBox.Checked;

            if(!this.points.GetVertAxis.Automatic)
            {
                this.points.GetVertAxis.SetMinMax(0, 100);
            }

            this.tChart.Refresh();
        }

        #endregion
    }
}
728x90
그리드형(광고전용)
Posted by icodebroker
,