예제 #1
0
 /// <summary>
 /// 默认构造函数
 /// </summary>
 public ChartSettingOption()
 {
     FontOfXYTitle             = new FontSettingOption();
     FontOfXY2Title            = new FontSettingOption();
     SeriesChartType           = SeriesChartType.Point;
     XLabelAngle               = new EnableInteger(0, false);
     this.BorderWidth          = 5;
     this.MarkerSize           = 5;
     LegendTableStyle          = LegendTableStyle.Wide;
     this.SeriesSettingOptions = new Dictionary <string, SeriesSettingOption>();
 }
예제 #2
0
        /// <summary>
        /// 默认构造函数
        /// </summary>
        public ChartSettingOption(Chart chart1) : this()
        {
            var legend = chart1.Legends[0];
            var chart  = chart1.ChartAreas[0];

            foreach (var item in chart1.Series)
            {
                var opt = new SeriesSettingOption(item.XValueType, item.YValueType)
                {
                    AxisTypeOfX     = item.XAxisType,
                    AxisTypeOfY     = item.YAxisType,
                    BorderWidth     = item.BorderWidth,
                    MarkerSize      = item.MarkerSize,
                    SeriesChartType = item.ChartType,
                    Color           = item.Color
                };
                //if ( item.Color.A == 0)
                //{
                //    opt.Color = Color.Blue;
                //}
                SeriesSettingOptions[item.Name] = opt;
            }

            if (chart1.Titles.Count == 0)
            {
                Title        = new EnableString("绘图");
                FontOfTitle  = new FontSettingOption(new Font(FontSettingOption.DefaultFontFamily, 16), Color.Black);
                TitleDocking = Docking.Top;
            }
            else
            {
                Title        = new EnableString(chart1.Titles[0].Text);
                FontOfTitle  = new FontSettingOption(chart1.Titles[0].Font, chart1.Titles[0].ForeColor);
                TitleDocking = chart1.Titles[0].Docking;
            }


            //main
            AxisColor            = chart.AxisX.LineColor;
            AxisWidth            = new EnableInteger(chart.AxisX.LineWidth);
            ValueSpanOfX         = new EnableFloatSpan(chart.AxisX.Minimum, chart.AxisX.Maximum);
            ValueSpanOfY         = new EnableFloatSpan(chart.AxisY.Minimum, chart.AxisY.Maximum);
            IntervalOfX          = new EnableFloat(chart.AxisX.Interval);
            IntervalOfY          = new EnableFloat(chart.AxisY.Interval);
            TitleOfX             = new EnableString("历元");
            TitleOfY             = new EnableString("偏差(m)");
            IsShowGridX          = chart.AxisX.MajorGrid.Enabled;
            IsShowGridY          = chart.AxisY.MajorGrid.Enabled;
            IsStartedFromZeroOfX = chart.AxisX.IsStartedFromZero;
            IsStartedFromZeroOfY = chart.AxisY.IsStartedFromZero;
            AxisXLableFormat     = new EnableString(chart.AxisX.LabelStyle.Format);
            AxisYLableFormat     = new EnableString(chart.AxisY.LabelStyle.Format);
            FontOfAxiesLabel     = new FontSettingOption(chart.AxisX.LabelStyle.Font, chart.AxisX.LabelStyle.ForeColor);
            FontOfXYTitle        = new FontSettingOption(chart.AxisX.TitleFont, chart.AxisX.TitleForeColor);
            LogarithmBaseX       = new EnableFloat(chart.AxisX.LogarithmBase, chart.AxisX.IsLogarithmic);
            LogarithmBaseY       = new EnableFloat(chart.AxisY.LogarithmBase, chart.AxisY.IsLogarithmic);

            XLabelAngle = new EnableInteger(chart.AxisX.LabelStyle.Angle, false);


            //sub
            Axis2Color            = chart.AxisY2.LineColor;
            Axis2Width            = new EnableInteger(chart.AxisX2.LineWidth);
            ValueSpanOfX2         = new EnableFloatSpan(chart.AxisX2.Minimum, chart.AxisX2.Maximum);
            ValueSpanOfY2         = new EnableFloatSpan(chart.AxisY2.Minimum, chart.AxisY2.Maximum);
            IntervalOfX2          = new EnableFloat(chart.AxisX2.Interval);
            IntervalOfY2          = new EnableFloat(chart.AxisY2.Interval);
            TitleOfX2             = new EnableString("历元");
            TitleOfY2             = new EnableString("偏差(m)");
            IsShowGridX2          = chart.AxisX2.MajorGrid.Enabled;
            IsShowGridY2          = chart.AxisY2.MajorGrid.Enabled;
            IsStartedFromZeroOfX2 = chart.AxisX2.IsStartedFromZero;
            IsStartedFromZeroOfY2 = chart.AxisY2.IsStartedFromZero;
            AxisX2LableFormat     = new EnableString(chart.AxisX2.LabelStyle.Format);
            AxisY2LableFormat     = new EnableString(chart.AxisY2.LabelStyle.Format);
            FontOfAxies2Label     = new FontSettingOption(chart.AxisX2.LabelStyle.Font, chart.AxisX2.LabelStyle.ForeColor);
            FontOfXY2Title        = new FontSettingOption(chart.AxisX2.TitleFont, chart.AxisX2.TitleForeColor);

            LogarithmBaseX2 = new EnableFloat(chart.AxisX2.LogarithmBase, chart.AxisX2.IsLogarithmic);
            LogarithmBaseY2 = new EnableFloat(chart.AxisY2.LogarithmBase, chart.AxisY2.IsLogarithmic);

            //legend
            LegendTableStyle = legend.TableStyle;
            LegendStyle      = legend.LegendStyle;
            LegendDocking    = legend.Docking;
            LegnedX          = legend.Position.X;
            LegnedY          = legend.Position.Y;
            LegendSize       = legend.Position.Size;
            LengendFont      = new FontSettingOption(legend.Font, legend.ForeColor);
        }