Ejemplo n.º 1
0
        internal SLNumberDataSourceType()
        {
            this.UseNumberReference = true;

            this.NumberReference = new SLNumberReference();
            this.NumberLiteral   = new SLNumberLiteral();
        }
Ejemplo n.º 2
0
        internal SLNumberDataSourceType()
        {
            this.UseNumberReference = true;

            this.NumberReference = new SLNumberReference();
            this.NumberLiteral = new SLNumberLiteral();
        }
Ejemplo n.º 3
0
        internal SLNumberLiteral Clone()
        {
            SLNumberLiteral nl = new SLNumberLiteral();
            nl.FormatCode = this.FormatCode;
            nl.PointCount = this.PointCount;
            for (int i = 0; i < this.Points.Count; ++i)
            {
                nl.Points.Add(this.Points[i].Clone());
            }

            return nl;
        }
Ejemplo n.º 4
0
        internal SLNumberLiteral Clone()
        {
            SLNumberLiteral nl = new SLNumberLiteral();

            nl.FormatCode = this.FormatCode;
            nl.PointCount = this.PointCount;
            for (int i = 0; i < this.Points.Count; ++i)
            {
                nl.Points.Add(this.Points[i].Clone());
            }

            return(nl);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Set a bubble chart using one of the built-in bubble chart types.
        /// </summary>
        /// <param name="ChartType">A built-in bubble chart type.</param>
        /// <param name="Options">Chart customization options.</param>
        public void SetChartType(SLBubbleChartType ChartType, SLBubbleChartOptions Options)
        {
            this.Is3D = SLChartTool.Is3DChart(ChartType);

            int i, index;
            SLNumberLiteral nl = new SLNumberLiteral();
            nl.FormatCode = "General";
            nl.PointCount = (uint)(this.EndRowIndex - this.StartRowIndex);
            for (i = 0; i < (this.EndRowIndex - this.StartRowIndex); ++i)
            {
                nl.Points.Add(new SLNumericPoint() { Index = (uint)i, NumericValue = "1" });
            }

            double fTemp = 0;

            List<SLDataSeries> series = new List<SLDataSeries>();
            SLDataSeries ser;
            for (index = 0, i = 0; i < this.PlotArea.DataSeries.Count; ++index, ++i)
            {
                ser = new SLDataSeries(this.listThemeColors);
                ser.Index = (uint)index;
                ser.Order = (uint)index;
                ser.IsStringReference = null;
                ser.StringReference = this.PlotArea.DataSeries[i].StringReference.Clone();

                ser.AxisData = this.PlotArea.DataSeries[i].AxisData.Clone();
                if (this.PlotArea.DataSeries[i].StringReference.Points.Count > 0)
                {
                    foreach (var pt in ser.AxisData.StringReference.Points)
                    {
                        ++pt.Index;
                    }

                    // move one row up
                    --ser.AxisData.StringReference.StartRowIndex;
                    ser.AxisData.StringReference.RefreshFormula();

                    ser.AxisData.StringReference.Points.Insert(0,
                        this.PlotArea.DataSeries[i].StringReference.Points[0].Clone());
                    ++ser.AxisData.StringReference.PointCount;
                }
                ser.NumberData = this.PlotArea.DataSeries[i].NumberData.Clone();
                if (this.PlotArea.DataSeries[i].StringReference.Points.Count > 1)
                {
                    foreach (var pt in ser.NumberData.NumberReference.NumberingCache.Points)
                    {
                        ++pt.Index;
                    }

                    --ser.NumberData.NumberReference.StartRowIndex;
                    ser.NumberData.NumberReference.RefreshFormula();

                    if (double.TryParse(this.PlotArea.DataSeries[i].StringReference.Points[1].NumericValue, NumberStyles.Any, CultureInfo.InvariantCulture, out fTemp))
                    {
                        ser.NumberData.NumberReference.NumberingCache.Points.Insert(0, new SLNumericPoint() { Index = 0, NumericValue = fTemp.ToString(CultureInfo.InvariantCulture) });
                    }
                    else
                    {
                        ser.NumberData.NumberReference.NumberingCache.Points.Insert(0, new SLNumericPoint() { Index = 0, NumericValue = "0" });
                    }
                    ++ser.NumberData.NumberReference.NumberingCache.PointCount;
                }

                ++i;
                if (i < this.PlotArea.DataSeries.Count)
                {
                    ser.BubbleSize = this.PlotArea.DataSeries[i].NumberData.Clone();

                    if (this.PlotArea.DataSeries[i].StringReference.Points.Count > 2)
                    {
                        foreach (var pt in ser.BubbleSize.NumberReference.NumberingCache.Points)
                        {
                            ++pt.Index;
                        }

                        --ser.BubbleSize.NumberReference.StartRowIndex;
                        ser.BubbleSize.NumberReference.RefreshFormula();

                        if (double.TryParse(this.PlotArea.DataSeries[i].StringReference.Points[2].NumericValue, NumberStyles.Any, CultureInfo.InvariantCulture, out fTemp))
                        {
                            ser.BubbleSize.NumberReference.NumberingCache.Points.Insert(0, new SLNumericPoint() { Index = 0, NumericValue = fTemp.ToString(CultureInfo.InvariantCulture) });
                        }
                        else
                        {
                            ser.BubbleSize.NumberReference.NumberingCache.Points.Insert(0, new SLNumericPoint() { Index = 0, NumericValue = "0" });
                        }
                        ++ser.BubbleSize.NumberReference.NumberingCache.PointCount;
                    }
                }
                else
                {
                    ser.BubbleSize.UseNumberLiteral = true;
                    ser.BubbleSize.NumberLiteral = nl.Clone();
                }
                series.Add(ser);
            }

            this.PlotArea.DataSeries = series;

            SLDataSeriesChartType vType;
            int iChartType;
            switch (ChartType)
            {
                case SLBubbleChartType.Bubble:
                    vType = SLDataSeriesChartType.BubbleChart;
                    this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType);
                    iChartType = (int)vType;
                    this.PlotArea.UsedChartTypes[iChartType] = true;
                    this.PlotArea.UsedChartOptions[iChartType].BubbleScale = 100;
                    if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options);
                    this.PlotArea.SetDataSeriesChartType(vType);

                    foreach (SLDataSeries ds in this.PlotArea.DataSeries)
                    {
                        ds.Options.Bubble3D = false;
                    }

                    this.SetPlotAreaValueAxes();
                    this.PlotArea.HasPrimaryAxes = true;
                    break;
                case SLBubbleChartType.Bubble3D:
                    vType = SLDataSeriesChartType.BubbleChart;
                    this.IsCombinable = SLChartTool.IsCombinationChartFriendly(vType);
                    iChartType = (int)vType;
                    this.PlotArea.UsedChartTypes[iChartType] = true;
                    this.PlotArea.UsedChartOptions[iChartType].BubbleScale = 100;
                    if (Options != null) this.PlotArea.UsedChartOptions[iChartType].MergeOptions(Options);
                    this.PlotArea.SetDataSeriesChartType(vType);

                    foreach (SLDataSeries ds in this.PlotArea.DataSeries)
                    {
                        ds.Options.Bubble3D = true;
                    }

                    this.SetPlotAreaValueAxes();
                    this.PlotArea.HasPrimaryAxes = true;
                    break;
            }
        }