Esempio n. 1
1
 public void SaveStyle(string styleName, CustomChart chart, DiagramTypeEnum type)
 {
     if (styles.ContainsKey(styleName))
         styles[styleName].ApplyFrom(chart);
     else
     {
         styles.Add(styleName, new StyleInfo(chart) { Name = styleName, Type=type });
     }
 }
Esempio n. 2
0
        public ChartSetupForm(BusinessGraphicsSourceDesign source)
        {
            InitializeComponent();

            // Устанавливаем размер документа, чтобы не было лишнего пустого поля.
            diagram1.Model.DocumentSize.Width = source.Chart.Width;
            diagram1.Model.DocumentSize.Height = source.Chart.Height;
            this.source = source;

            if (String.IsNullOrEmpty(source.DiagramStyle))
                source.DiagramStyle = defaultName;

            if (String.IsNullOrEmpty(source.SubDiagramStyle))
                source.SubDiagramStyle = defaultName;

            source.LoadStyles();
            this.DiagramStyleData = source.DiagramStyleData;
            this.DiagramStyle = source.DiagramStyle;
            this.SubDiagramStyleData = source.SubDiagramStyleData;
            this.SubDiagramStyle = source.SubDiagramStyle;

            if (source.DiagramStyle != defaultName && source.DiagramStyleData==null) this.DiagramStyleData = this.GetStyleData(source.DiagramStyle);
            if (source.SubDiagramStyle != defaultName && source.SubDiagramStyleData == null) this.SubDiagramStyleData = this.GetStyleData(source.SubDiagramStyle);

            this.tabControlAdv1.SelectedIndexChanged += new System.EventHandler(this.tabControlAdv1_SelectedIndexChanged);
            ReloadStyleList();
            styleComboBox.SelectedItem = DiagramStyle;

            source.InitializeChart(true);
            this.chart1 = source.Chart;

            LoadStyle();
            RefreshChart();
            this.FormClosing += new FormClosingEventHandler(ChartSetupForm_FormClosing);
            styleComboBox.SelectedValueChanged += new EventHandler(styleComboBox_SelectedValueChanged);

            saveButton.Enabled = styleComboBox.SelectedValue.ToString() != defaultName;
            removeButton.Enabled = styleComboBox.SelectedValue.ToString() != defaultName;
            if (!source.AllowSubDiagram)
            {
                this.tabControlAdv1.TabPages[1].Hide();
            }
            else
            {
                this.tabControlAdv1.TabPages[1].Show();
            }

            zoomCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown;
            zoomCombo.Items.AddRange(Percent.CreateList());
            zoomCombo.Text = "100%";
            
            tip = new SuperToolTip();
            tip.UseFading = SuperToolTip.FadingType.System;
        }
Esempio n. 3
0
        /// <summary>
        /// Загрузить настройки из существующей диаграммы.
        /// </summary>
        /// <param name="chart">Диаграмма, настройки которой загружаются.</param>
        private void LoadSettingsFromChart(CustomChart chart)
        {
            base.Debug = chart.Debug;
            base.ClipGauges = chart.ClipGauges;
            base.LegendBox.Visible = chart.LegendBox.Visible;
            base.XAxis.Orientation = chart.XAxis.Orientation;
            base.DefaultSeries.Type = chart.DefaultSeries.Type;
            base.DefaultSeries.GaugeBorderShape = chart.DefaultSeries.GaugeBorderShape;
            base.DefaultSeries.GaugeType = chart.DefaultSeries.GaugeType;
            base.DefaultSeries.GaugeBorderBox.DefaultCorner = chart.DefaultSeries.GaugeBorderBox.DefaultCorner;
            base.ShadingEffectMode = chart.ShadingEffectMode;
            base.ChartArea.Background = chart.ChartArea.Background;
            base.ChartArea.Background.Mode = chart.ChartArea.Background.Mode;
            base.DefaultSeries.GaugeBorderBox.Background.Color = chart.DefaultSeries.GaugeBorderBox.Background.Color;

            base.DefaultSeries.DefaultElement.LabelTemplate = chart.DefaultSeries.DefaultElement.LabelTemplate;
            base.Palette = chart.Palette;
            base.DefaultSeries.DefaultElement.Transparency = chart.DefaultSeries.DefaultElement.Transparency;

            base.ChartArea.LegendBox.HeaderLabel = chart.ChartArea.LegendBox.HeaderLabel;
            base.ChartArea.LegendBox.LabelStyle = chart.ChartArea.LegendBox.LabelStyle;
            string titleText = base.ChartArea.TitleBox.Label.Text; // Сохраним название, чтобы не затерлось
            base.ChartArea.TitleBox.Label = chart.ChartArea.TitleBox.Label;
            base.ChartArea.TitleBox.Label.Text = titleText;
            base.ChartArea.XAxis.Label = chart.ChartArea.XAxis.Label;
            base.ChartArea.YAxis.Label = chart.ChartArea.YAxis.Label;
            base.ChartArea.XAxis.ZeroTick.Label = chart.ChartArea.XAxis.ZeroTick.Label;
            base.ChartArea.YAxis.ZeroTick.Label = chart.ChartArea.YAxis.ZeroTick.Label;
            base.ChartArea.XAxis.DefaultTick.Label = chart.ChartArea.XAxis.DefaultTick.Label;
            base.ChartArea.YAxis.DefaultTick.Label = chart.ChartArea.YAxis.DefaultTick.Label;
            base.DefaultElement.SmartLabel = chart.DefaultElement.SmartLabel;

            base.LegendBox = chart.LegendBox;
            base.ChartArea = chart.ChartArea;
            base.Background = chart.Background;
            base.DefaultElement = chart.DefaultElement;

            base.BackgroundImage = chart.BackgroundImage;
            base.BackgroundImageLayout = chart.BackgroundImageLayout;
            base.BorderStyle = chart.BorderStyle;
            base.Background = chart.Background;
            base.Depth = chart.Depth;
            base.ExplodedSliceAmount = chart.ExplodedSliceAmount;
            base.PieLabelMode = chart.PieLabelMode;
            base.ShadingEffectMode = chart.ShadingEffectMode;
            base.Use3D = chart.Use3D;
            base.XAxis = chart.XAxis;
            base.YAxis = chart.YAxis;
            base.TitleBox = chart.TitleBox;

            SetDiagramType(_subDiagramMode);
        }
Esempio n. 4
0
 /// <summary>
 /// Очистить стиль диаграммы.
 /// </summary>
 public void ClearStyle()
 {
     CustomChart chart = new CustomChart();
     LoadSettingsFromChart(chart);
 }
Esempio n. 5
0
 public ChartWrapper(CustomChart chart)
 {
     this.chart = chart;
 }
Esempio n. 6
0
        private void tabControlAdv1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (tabControlAdv1.SelectedIndex == 0)
            {
                if (somethingChanged) this.SubDiagramStyleData = chart1.SaveStyle();
                source.SetNormalMode();
                this.chart1 = source.Chart;
                Chart = chart1;
            }
            if (tabControlAdv1.SelectedIndex == 1)
            {
                if (somethingChanged) this.DiagramStyleData = chart1.SaveStyle();
                source.SetDetailedMode();
                this.chart1 = source.Chart;
                source.SetDetailedMode();
                Chart = chart1;
            }
            ReloadStyleList();
            //RefreshChart();
            LoadStyle();

            try
            {
                reloadFlag = true;

                if (tabControlAdv1.SelectedIndex == 0)
                {
                    styleComboBox.SelectedItem = DiagramStyle;
                }
                else
                {
                    styleComboBox.SelectedItem = SubDiagramStyle;
                }
            }
            finally
            {
                reloadFlag = false;
            }
            somethingChanged = false;
        }
Esempio n. 7
0
 //присвоить свойства из Data в chart
 internal  void ApplyTo(CustomChart chart)
 {
     chart.LoadStyle(Data);
 }
Esempio n. 8
0
 //получить свойства из chart в Data
 internal void ApplyFrom(CustomChart chart)
 {
     Data = chart.SaveStyle();
 }
Esempio n. 9
0
 public StyleInfo(CustomChart chart)
     : this()
 {
     ApplyFrom(chart);
 }
Esempio n. 10
0
 public void LoadStyle(string styleName, CustomChart chart)
 {
     if (styleName == null) return; // Иногда валится исключение
     if (styles.ContainsKey(styleName))
         styles[styleName].ApplyTo(chart);
 }
Esempio n. 11
0
 public DefaultElementWrapper(Element element, CustomChart chart)
 {
     this.element = element;
     this.chart = chart;
 }