Exemplo n.º 1
0
        internal void MergeOptions(SLPieChartOptions pco)
        {
            this.VaryColors      = pco.VaryColors;
            this.FirstSliceAngle = pco.FirstSliceAngle;
            this.HoleSize        = pco.HoleSize;
            this.GapWidth        = pco.GapWidth;
            this.HasSplit        = pco.HasSplit;
            this.SplitType       = pco.SplitType;
            this.SplitPosition   = pco.SplitPosition;

            this.SecondPiePoints.Clear();
            foreach (int i in pco.SecondPiePoints)
            {
                this.SecondPiePoints.Add(i);
            }
            this.SecondPiePoints.Sort();

            this.SecondPieSize = pco.SecondPieSize;

            this.SeriesLinesShapeProperties = pco.ShapeProperties.Clone();
        }
Exemplo n.º 2
0
        internal SLPieChartOptions Clone()
        {
            SLPieChartOptions pco = new SLPieChartOptions(this.ShapeProperties.listThemeColors, this.ShapeProperties.ThrowExceptionsIfAny);

            pco.VaryColors       = this.VaryColors;
            pco.iFirstSliceAngle = this.iFirstSliceAngle;
            pco.byHoleSize       = this.byHoleSize;
            pco.iGapWidth        = this.iGapWidth;
            pco.HasSplit         = this.HasSplit;
            pco.SplitType        = this.SplitType;
            pco.SplitPosition    = this.SplitPosition;

            pco.SecondPiePoints = new List <int>();
            for (int i = 0; i < this.SecondPiePoints.Count; ++i)
            {
                pco.SecondPiePoints.Add(this.SecondPiePoints[i]);
            }

            pco.iSecondPieSize = this.iSecondPieSize;

            pco.ShapeProperties = this.ShapeProperties.Clone();

            return(pco);
        }
        internal SLPieChartOptions Clone()
        {
            SLPieChartOptions pco = new SLPieChartOptions(this.ShapeProperties.listThemeColors);
            pco.VaryColors = this.VaryColors;
            pco.iFirstSliceAngle = this.iFirstSliceAngle;
            pco.byHoleSize = this.byHoleSize;
            pco.iGapWidth = this.iGapWidth;
            pco.HasSplit = this.HasSplit;
            pco.SplitType = this.SplitType;
            pco.SplitPosition = this.SplitPosition;

            pco.SecondPiePoints = new List<int>();
            for (int i = 0; i < this.SecondPiePoints.Count; ++i)
            {
                pco.SecondPiePoints.Add(this.SecondPiePoints[i]);
            }

            pco.iSecondPieSize = this.iSecondPieSize;

            pco.ShapeProperties = this.ShapeProperties.Clone();

            return pco;
        }
Exemplo n.º 4
0
        internal void MergeOptions(SLPieChartOptions pco)
        {
            this.VaryColors = pco.VaryColors;
            this.FirstSliceAngle = pco.FirstSliceAngle;
            this.HoleSize = pco.HoleSize;
            this.GapWidth = pco.GapWidth;
            this.HasSplit = pco.HasSplit;
            this.SplitType = pco.SplitType;
            this.SplitPosition = pco.SplitPosition;

            this.SecondPiePoints.Clear();
            foreach (int i in pco.SecondPiePoints)
            {
                this.SecondPiePoints.Add(i);
            }
            this.SecondPiePoints.Sort();

            this.SecondPieSize = pco.SecondPieSize;

            this.SeriesLinesShapeProperties = pco.ShapeProperties.Clone();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Plot a specific data series as a pie chart. WARNING: Only weak checks done on whether the resulting combination chart is valid. Use with caution.
        /// </summary>
        /// <param name="DataSeriesIndex">The index of the data series. This is 1-based indexing, so it's 1 for the 1st data series, 2 for the 2nd data series and so on.</param>
        /// <param name="IsExploded">True to explode this data series. False otherwise.</param>
        /// <param name="Options">Chart customization options.</param>
        public void PlotDataSeriesAsPieChart(int DataSeriesIndex, bool IsExploded, SLPieChartOptions Options)
        {
            // the original chart is not combinable
            if (!this.IsCombinable) return;

            int index = DataSeriesIndex - 1;

            // out of bounds
            if (index < 0 || index >= this.PlotArea.DataSeries.Count) return;

            SLDataSeriesChartType vType = SLDataSeriesChartType.PieChart;
            int iChartType = (int)vType;

            if (this.PlotArea.UsedChartTypes[iChartType])
            {
                // the chart is already used.

                // don't have to do anything if no options passed in.
                if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options);
            }
            else
            {
                this.PlotArea.UsedChartTypes[iChartType] = true;
                this.PlotArea.UsedChartOptions[iChartType].VaryColors = true;
                this.PlotArea.UsedChartOptions[iChartType].FirstSliceAngle = 0;
                if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options);
            }

            this.PlotArea.DataSeries[index].ChartType = vType;

            if (IsExploded) this.PlotArea.DataSeries[index].Options.iExplosion = null;
            else this.PlotArea.DataSeries[index].Options.Explosion = 25;
        }
Exemplo n.º 6
0
        /// <summary>
        /// Set a pie chart using one of the built-in pie chart types.
        /// </summary>
        /// <param name="ChartType">A built-in pie chart type.</param>
        /// <param name="Options">Chart customization options.</param>
        public void SetChartType(SLPieChartType ChartType, SLPieChartOptions Options)
        {
            this.Is3D = SLChartTool.Is3DChart(ChartType);

            SLDataSeriesChartType vType;
            int iChartType;
            switch (ChartType)
            {
                case SLPieChartType.Pie:
                    vType = SLDataSeriesChartType.PieChart;
                    this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType);
                    iChartType = (int)vType;
                    this.PlotArea.UsedChartTypes[iChartType] = true;
                    this.PlotArea.UsedChartOptions[iChartType].VaryColors = true;
                    this.PlotArea.UsedChartOptions[iChartType].FirstSliceAngle = 0;
                    if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options);
                    this.PlotArea.SetDataSeriesChartType(vType);
                    break;
                case SLPieChartType.Pie3D:
                    this.RotateX = 30;
                    if (Options != null)
                    {
                        this.RotateY = Options.FirstSliceAngle;
                    }
                    else
                    {
                        this.RotateY = 0;
                    }
                    this.RightAngleAxes = false;
                    this.Perspective = 30;

                    vType = SLDataSeriesChartType.Pie3DChart;
                    this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType);
                    iChartType = (int)vType;
                    this.PlotArea.UsedChartTypes[iChartType] = true;
                    this.PlotArea.UsedChartOptions[iChartType].VaryColors = true;
                    if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options);
                    this.PlotArea.SetDataSeriesChartType(vType);
                    break;
                case SLPieChartType.PieOfPie:
                    vType = SLDataSeriesChartType.OfPieChartPie;
                    this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType);
                    iChartType = (int)vType;
                    this.PlotArea.UsedChartTypes[iChartType] = true;
                    this.PlotArea.UsedChartOptions[iChartType].VaryColors = true;
                    this.PlotArea.UsedChartOptions[iChartType].GapWidth = 100;
                    this.PlotArea.UsedChartOptions[iChartType].SecondPieSize = 75;
                    if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options);
                    this.PlotArea.SetDataSeriesChartType(vType);
                    break;
                case SLPieChartType.ExplodedPie:
                    vType = SLDataSeriesChartType.PieChart;
                    this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType);
                    iChartType = (int)vType;
                    this.PlotArea.UsedChartTypes[iChartType] = true;
                    this.PlotArea.UsedChartOptions[iChartType].VaryColors = true;
                    this.PlotArea.UsedChartOptions[iChartType].FirstSliceAngle = 0;
                    if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options);
                    this.PlotArea.SetDataSeriesChartType(vType);

                    foreach (SLDataSeries ds in this.PlotArea.DataSeries)
                    {
                        ds.Options.Explosion = 25;
                    }
                    break;
                case SLPieChartType.ExplodedPie3D:
                    this.RotateX = 30;
                    if (Options != null)
                    {
                        this.RotateY = Options.FirstSliceAngle;
                    }
                    else
                    {
                        this.RotateY = 0;
                    }
                    this.RightAngleAxes = false;
                    this.Perspective = 30;

                    vType = SLDataSeriesChartType.Pie3DChart;
                    this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType);
                    iChartType = (int)vType;
                    this.PlotArea.UsedChartTypes[iChartType] = true;
                    this.PlotArea.UsedChartOptions[iChartType].VaryColors = true;
                    if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options);
                    this.PlotArea.SetDataSeriesChartType(vType);

                    foreach (SLDataSeries ds in this.PlotArea.DataSeries)
                    {
                        ds.Options.Explosion = 25;
                    }
                    break;
                case SLPieChartType.BarOfPie:
                    vType = SLDataSeriesChartType.OfPieChartBar;
                    this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType);
                    iChartType = (int)vType;
                    this.PlotArea.UsedChartTypes[iChartType] = true;
                    this.PlotArea.UsedChartOptions[iChartType].VaryColors = true;
                    this.PlotArea.UsedChartOptions[iChartType].GapWidth = 100;
                    this.PlotArea.UsedChartOptions[iChartType].SecondPieSize = 75;
                    if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options);
                    this.PlotArea.SetDataSeriesChartType(vType);
                    break;
            }
        }
Exemplo n.º 7
0
        private void PlotDataSeriesAsOfPieChart(int DataSeriesIndex, bool IsBarOfPie, SLPieChartOptions Options)
        {
            // the original chart is not combinable
            if (!this.IsCombinable) return;

            int index = DataSeriesIndex - 1;

            // out of bounds
            if (index < 0 || index >= this.PlotArea.DataSeries.Count) return;

            SLDataSeriesChartType vType = IsBarOfPie ? SLDataSeriesChartType.OfPieChartBar : SLDataSeriesChartType.OfPieChartPie;
            int iChartType = (int)vType;

            if (this.PlotArea.UsedChartTypes[iChartType])
            {
                // the chart is already used.

                // don't have to do anything if no options passed in.
                if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options);
            }
            else
            {
                this.PlotArea.UsedChartTypes[iChartType] = true;
                this.PlotArea.UsedChartOptions[iChartType].VaryColors = true;
                this.PlotArea.UsedChartOptions[iChartType].GapWidth = 100;
                this.PlotArea.UsedChartOptions[iChartType].SecondPieSize = 75;
                if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options);
            }

            this.PlotArea.DataSeries[index].ChartType = vType;
        }
Exemplo n.º 8
0
 /// <summary>
 /// Plot a specific data series as a pie-of-pie chart. WARNING: Only weak checks done on whether the resulting combination chart is valid. Use with caution.
 /// </summary>
 /// <param name="DataSeriesIndex">The index of the data series. This is 1-based indexing, so it's 1 for the 1st data series, 2 for the 2nd data series and so on.</param>
 /// <param name="Options">Chart customization options.</param>
 public void PlotDataSeriesAsPieOfPieChart(int DataSeriesIndex, SLPieChartOptions Options)
 {
     this.PlotDataSeriesAsOfPieChart(DataSeriesIndex, false, Options);
 }
Exemplo n.º 9
0
 /// <summary>
 /// Plot a specific data series as a bar-of-pie chart. WARNING: Only weak checks done on whether the resulting combination chart is valid. Use with caution.
 /// </summary>
 /// <param name="DataSeriesIndex">The index of the data series. This is 1-based indexing, so it's 1 for the 1st data series, 2 for the 2nd data series and so on.</param>
 /// <param name="Options">Chart customization options.</param>
 public void PlotDataSeriesAsBarOfPieChart(int DataSeriesIndex, SLPieChartOptions Options)
 {
     this.PlotDataSeriesAsOfPieChart(DataSeriesIndex, true, Options);
 }
Exemplo n.º 10
0
        /// <summary>
        /// Set a doughnut chart using one of the built-in doughnut chart types.
        /// </summary>
        /// <param name="ChartType">A built-in doughnut chart type.</param>
        /// <param name="Options">Chart customization options.</param>
        public void SetChartType(SLDoughnutChartType ChartType, SLPieChartOptions Options)
        {
            this.Is3D = SLChartTool.Is3DChart(ChartType);

            SLDataSeriesChartType vType;
            int iChartType;
            switch (ChartType)
            {
                case SLDoughnutChartType.Doughnut:
                    vType = SLDataSeriesChartType.DoughnutChart;
                    this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType);
                    iChartType = (int)vType;
                    this.PlotArea.UsedChartTypes[iChartType] = true;
                    this.PlotArea.UsedChartOptions[iChartType].VaryColors = true;
                    this.PlotArea.UsedChartOptions[iChartType].FirstSliceAngle = 0;
                    this.PlotArea.UsedChartOptions[iChartType].HoleSize = 50;
                    if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options);
                    this.PlotArea.SetDataSeriesChartType(vType);
                    break;
                case SLDoughnutChartType.ExplodedDoughnut:
                    vType = SLDataSeriesChartType.DoughnutChart;
                    this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType);
                    iChartType = (int)vType;
                    this.PlotArea.UsedChartTypes[iChartType] = true;
                    this.PlotArea.UsedChartOptions[iChartType].VaryColors = true;
                    this.PlotArea.UsedChartOptions[iChartType].FirstSliceAngle = 0;
                    this.PlotArea.UsedChartOptions[iChartType].HoleSize = 50;
                    if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options);
                    this.PlotArea.SetDataSeriesChartType(vType);

                    foreach (SLDataSeries ds in this.PlotArea.DataSeries)
                    {
                        ds.Options.Explosion = 25;
                    }
                    break;
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// Creates an instance of SLPieChartOptions with theme information.
 /// </summary>
 /// <returns>An SLPieChartOptions object with theme information.</returns>
 public SLPieChartOptions CreatePieChartOptions()
 {
     SLPieChartOptions pco = new SLPieChartOptions(this.listThemeColors);
     if (this.IsStylish)
     {
         pco.Line.Width = 0.75m;
         pco.Line.CapType = A.LineCapValues.Flat;
         pco.Line.CompoundLineType = A.CompoundLineValues.Single;
         pco.Line.Alignment = A.PenAlignmentValues.Center;
         pco.Line.SetSolidLine(A.SchemeColorValues.Text1, 0.65m, 0);
         pco.Line.JoinType = SLA.SLLineJoinValues.Round;
     }
     return pco;
 }