Exemplo n.º 1
0
        /// <inheritdoc/>
        public override void Assign(Base source)
        {
            base.Assign(source);
            MSChartSeries src = source as MSChartSeries;

            Filter             = src.Filter;
            SortOrder          = src.SortOrder;
            SortBy             = src.SortBy;
            GroupBy            = src.GroupBy;
            GroupInterval      = src.GroupInterval;
            GroupFunction      = src.GroupFunction;
            Collect            = src.Collect;
            CollectValue       = src.CollectValue;
            CollectedItemText  = src.CollectedItemText;
            CollectedItemColor = src.CollectedItemColor;
            PieExplode         = src.PieExplode;
            PieExplodeValue    = src.PieExplodeValue;

            XValue  = src.XValue;
            YValue1 = src.YValue1;
            YValue2 = src.YValue2;
            YValue3 = src.YValue3;
            YValue4 = src.YValue4;
            Color   = src.Color;
        }
Exemplo n.º 2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            MSChartSeries series   = tvChart.SelectedNode.Tag as MSChartSeries;
            string        areaName = series.SeriesSettings.ChartArea;

            if (areaName != "Default")
            {
                // delete non-default area exclusively owned by deleted series
                ChartArea area = ChartObject.Chart.ChartAreas.FindByName(areaName);
                ChartObject.Chart.ChartAreas.Remove(area);
                area.Dispose();
            }
            else
            {
                // delete this area and make the next area default one.
                if (ChartObject.Chart.ChartAreas.Count > 1)
                {
                    ChartArea area = ChartObject.Chart.ChartAreas.FindByName(areaName);
                    ChartObject.Chart.ChartAreas.Remove(area);
                    area.Dispose();
                    area      = ChartObject.Chart.ChartAreas[0];
                    area.Name = "Default";
                }
            }

            ChartObject.DeleteSeries(ChartObject.Series.IndexOf(series));
            PopulateSeriesTree(ChartObject);
            RefreshSample();
        }
Exemplo n.º 3
0
        /// <inheritdoc/>
        public override void OnBeforeInsert(int flags)
        {
            base.OnBeforeInsert(flags);
            MSChartSeries series = AddSeries(SeriesChartType.Column);

            series.CreateDummyData();
        }
Exemplo n.º 4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            using (GalleryForm form = new GalleryForm())
            {
                if (form.ShowDialog() == DialogResult.OK)
                {
                    ChartArea area = ChartObject.Chart.ChartAreas[0];
                    bool      newChartAreaNeeded = form.SelectedSeriesType == SeriesChartType.Pie ||
                                                   form.SelectedSeriesType == SeriesChartType.Doughnut ||
                                                   form.SelectedSeriesType == SeriesChartType.Funnel ||
                                                   form.SelectedSeriesType == SeriesChartType.Pyramid ||
                                                   form.SelectedSeriesType == SeriesChartType.Kagi ||
                                                   form.SelectedSeriesType == SeriesChartType.Renko ||
                                                   form.SelectedSeriesType == SeriesChartType.PointAndFigure ||
                                                   form.SelectedSeriesType == SeriesChartType.ThreeLineBreak;
                    if (form.NewArea || newChartAreaNeeded)
                    {
                        if (ChartObject.Series.Count > 0)
                        {
                            area = new ChartArea();
                            ChartObject.Chart.ChartAreas.Add(area);
                        }
                    }

                    MSChartSeries series = ChartObject.AddSeries(form.SelectedSeriesType);
                    series.SeriesSettings.ChartArea = area.Name;
                    series.CreateDummyData();
                    PopulateSeriesTree(series);
                    RefreshSample();
                }
            }
        }
Exemplo n.º 5
0
        private MSChartSeries CloneSeries(MSChartSeries source)
        {
            MSChartSeries series = AddSeries(source.SeriesSettings.ChartType);

            series.Assign(source);

            Chart tempChart = new Chart();

            FOriginalChartStream.Position = 0;
            tempChart.Serializer.Content  = SerializationContents.All;
            tempChart.Serializer.Load(FOriginalChartStream);

            Series tempSeries = tempChart.Series[0];

            tempChart.Series.Remove(tempSeries);
            tempSeries.Name = "";

            Series tempSeries1 = FChart.Series[FChart.Series.Count - 1];

            FChart.Series.Remove(tempSeries1);

            FChart.Series.Add(tempSeries);
            tempSeries.Points.Clear();

            tempChart.Dispose();
            tempSeries1.Dispose();

            return(series);
        }
Exemplo n.º 6
0
        private void btnDown_Click(object sender, EventArgs e)
        {
            MSChartSeries series      = tvChart.SelectedNode.Tag as MSChartSeries;
            Series        chartSeries = series.SeriesSettings;

            int index = ChartObject.Series.IndexOf(series);

            ChartObject.Series.RemoveAt(index);
            ChartObject.Chart.Series.RemoveAt(index);
            ChartObject.Series.Insert(index + 1, series);
            ChartObject.Chart.Series.Insert(index + 1, chartSeries);

            PopulateSeriesTree(series);
            RefreshSample();
        }
Exemplo n.º 7
0
        /// <summary>
        /// Adds a new series.
        /// </summary>
        /// <param name="chartType">The type of series.</param>
        /// <returns>The new <b>MSChartSeries</b> object.</returns>
        public MSChartSeries AddSeries(SeriesChartType chartType)
        {
            if (FChart.ChartAreas.Count == 0)
            {
                SetChartDefaults();
            }

            Series chartSeries = new Series();

            chartSeries.ChartType = chartType;
            FChart.Series.Add(chartSeries);

            MSChartSeries series = new MSChartSeries();

            Series.Add(series);
            series.CreateUniqueName();

            return(series);
        }
Exemplo n.º 8
0
        /// <inheritdoc/>
        public override void GetData()
        {
            base.GetData();

            if (DataSource != null && !IsOnGroup)
            {
                Series.ResetData();
                DataSource.Init(Filter);
                DataSource.First();

                while (DataSource.HasMoreRows)
                {
                    if (!String.IsNullOrEmpty(AutoSeriesColumn))
                    {
                        object autoSeriesKey = Report.Calc(AutoSeriesColumn);
                        if (autoSeriesKey != null)
                        {
                            MSChartSeries series = MakeAutoSeries(autoSeriesKey);
                            series.ProcessData();
                        }
                    }
                    else
                    {
                        Series.ProcessData();
                    }

                    DataSource.Next();
                }
            }

            Series.FinishData();

            if (AlignXValues)
            {
                Chart.AlignDataPointsByAxisLabel();
            }
            if (!String.IsNullOrEmpty(AutoSeriesColumn) && AutoSeriesSortOrder != SortOrder.None)
            {
                SortAutoSeries();
            }
        }
Exemplo n.º 9
0
        private MSChartSeries MakeAutoSeries(object autoSeriesKey)
        {
            string        seriesName = autoSeriesKey.ToString();
            MSChartSeries series     = null;

            if (FStartAutoSeries)
            {
                series = Series[0];
            }
            else
            {
                bool found = false;
                foreach (MSChartSeries s in Series)
                {
                    if (s.SeriesSettings.Name == seriesName)
                    {
                        series = s;
                        found  = true;
                        break;
                    }
                }

                if (!found)
                {
                    series = CloneSeries(Series[0]);
                    if (!String.IsNullOrEmpty(AutoSeriesColor))
                    {
                        object color = Report.Calc(AutoSeriesColor);
                        if (color is Color)
                        {
                            series.SeriesSettings.Color = (Color)color;
                        }
                    }
                }
            }

            series.SeriesSettings.Name = seriesName;
            FStartAutoSeries           = false;
            return(series);
        }
Exemplo n.º 10
0
        /// <inheritdoc/>
        public override void Serialize(FRWriter writer)
        {
            MSChartSeries s = writer.DiffObject as MSChartSeries;

            base.Serialize(writer);

            if (Filter != s.Filter)
            {
                writer.WriteStr("Filter", Filter);
            }
            if (SortOrder != s.SortOrder)
            {
                writer.WriteValue("SortOrder", SortOrder);
            }
            if (SortBy != s.SortBy)
            {
                writer.WriteValue("SortBy", SortBy);
            }
            if (GroupBy != s.GroupBy)
            {
                writer.WriteValue("GroupBy", GroupBy);
            }
            if (GroupInterval != s.GroupInterval)
            {
                writer.WriteFloat("GroupInterval", GroupInterval);
            }
            if (GroupFunction != s.GroupFunction)
            {
                writer.WriteValue("GroupFunction", GroupFunction);
            }
            if (Collect != s.Collect)
            {
                writer.WriteValue("Collect", Collect);
            }
            if (CollectValue != s.CollectValue)
            {
                writer.WriteFloat("CollectValue", CollectValue);
            }
            if (CollectedItemText != s.CollectedItemText)
            {
                writer.WriteStr("CollectedItemText", CollectedItemText);
            }
            if (CollectedItemColor != s.CollectedItemColor)
            {
                writer.WriteValue("CollectedItemColor", CollectedItemColor);
            }
            if (PieExplode != s.PieExplode)
            {
                writer.WriteValue("PieExplode", PieExplode);
            }
            if (PieExplodeValue != s.PieExplodeValue)
            {
                writer.WriteStr("PieExplodeValue", PieExplodeValue);
            }

            if (XValue != s.XValue)
            {
                writer.WriteStr("XValue", XValue);
            }
            if (YValue1 != s.YValue1)
            {
                writer.WriteStr("YValue1", YValue1);
            }
            if (YValue2 != s.YValue2)
            {
                writer.WriteStr("YValue2", YValue2);
            }
            if (YValue3 != s.YValue3)
            {
                writer.WriteStr("YValue3", YValue3);
            }
            if (YValue4 != s.YValue4)
            {
                writer.WriteStr("YValue4", YValue4);
            }
            if (Color != s.Color)
            {
                writer.WriteStr("Color", Color);
            }
        }
Exemplo n.º 11
0
 public SeriesInfo(MSChartSeries series)
 {
     Series      = series;
     ChartSeries = series.SeriesSettings;
 }