[MSCHART] 控件类型主要属性设置

protected static void SetLineStyle(Chart control, double max, double min, ChartValueType valueType)
        {
            /*            */
            //网格样式
            control.ChartAreas[0].AxisX.MajorGrid.LineColor = Color.Gainsboro;
            control.ChartAreas[0].AxisY.MajorGrid.LineColor = Color.Gainsboro;


            control.ChartAreas[0].AxisY.MajorGrid.Interval = 0.01;
            control.ChartAreas[0].AxisY.Title = "干密度(g / cm3)";
            control.ChartAreas[0].AxisY.TitleFont = new Font("宋体", 12);
            control.ChartAreas[0].AxisY.LabelStyle.Format = "0.00";
            control.ChartAreas[0].AxisY.LabelStyle.Interval = 0.01;
            control.ChartAreas[0].AxisY.MajorTickMark.Interval = 0.01;
            //Y轴最大值与最小值
            control.ChartAreas[0].AxisY.Maximum = max;
            control.ChartAreas[0].AxisY.Minimum = min;
            //X轴标签间隔
            control.ChartAreas[0].AxisX.Title = "含水率(%)";
            control.ChartAreas[0].AxisX.TitleFont = new Font("宋体", 12);


            control.ChartAreas[0].AxisX.MajorGrid.Interval = 1;
            control.ChartAreas[0].AxisX.LabelStyle.Interval = 1;
            control.ChartAreas[0].AxisX.MajorTickMark.Interval = 1;


            control.Series[0].ChartType = SeriesChartType.Spline;
            control.Series[0].Color = Color.Blue;
            control.Series[0].BorderWidth = 1;
            control.Series[0].MarkerStyle = MarkerStyle.Circle;
            control.Series[0].MarkerSize = 4;
            control.Series[0].MarkerBorderWidth = 1;
            control.Series[0].XValueType = valueType;
            control.Series[0].IsValueShownAsLabel = false;
        }
            control.ChartAreas[0].AxisY.LabelStyle.Format = "0.00";
            control.ChartAreas[0].AxisY.LabelStyle.Interval = 0.01;


 

你可能感兴趣的:([MSCHART] 控件类型主要属性设置)