示例#1
0
            /// <summary>
            /// Returns last calculated number cache for X axis.
            /// </summary>
            //internal XSSFNumberCache LastCaculatedXCache
            //{
            //    get
            //    {
            //        return lastCaclulatedXCache;
            //    }
            //}
            /// <summary>
            /// Returns last calculated number cache for Y axis.
            /// </summary>
            //internal XSSFNumberCache LastCalculatedYCache
            //{
            //    get
            //    {
            //        return lastCalculatedYCache;
            //    }
            //}

            internal void AddToChart(CT_ScatterChart ctScatterChart)
            {
                CT_ScatterSer scatterSer = ctScatterChart.AddNewSer();

                scatterSer.AddNewIdx().val   = (uint)this.id;
                scatterSer.AddNewOrder().val = (uint)this.order;

                /* TODO: add some logic to automatically recognize cell
                 * types and choose appropriate data representation for
                 * X axis.
                 */
                /*CT_AxDataSource xVal = scatterSer.AddNewXVal();
                 * CT_NumRef xNumRef = xVal.AddNewNumRef();
                 * xNumRef.f = (xMarker.FormatAsString());
                 *
                 * CT_NumDataSource yVal = scatterSer.AddNewYVal();
                 * CT_NumRef yNumRef = yVal.AddNewNumRef();
                 * yNumRef.f = (yMarker.FormatAsString());
                 *
                 * if (useCache)
                 * {
                 *  // We can not store cache since markers are not immutable
                 *  XSSFNumberCache.BuildCache(xMarker, xNumRef);
                 *  lastCalculatedYCache = XSSFNumberCache.BuildCache(yMarker, yNumRef);
                 * }
                 */
                CT_AxDataSource xVal = scatterSer.AddNewXVal();

                XSSFChartUtil.BuildAxDataSource <Tx>(xVal, xs);
                CT_NumDataSource yVal = scatterSer.AddNewYVal();

                XSSFChartUtil.BuildNumDataSource <Ty>(yVal, ys);
            }
示例#2
0
            internal void AddToChart(CT_LineChart ctLineChart)
            {
                CT_LineSer  ctLineSer  = ctLineChart.AddNewSer();
                CT_Grouping ctGrouping = ctLineChart.AddNewGrouping();

                ctGrouping.val = ST_Grouping.standard;
                ctLineSer.AddNewIdx().val   = (uint)id;
                ctLineSer.AddNewOrder().val = (uint)order;

                // No marker symbol on the chart line.
                ctLineSer.AddNewMarker().AddNewSymbol().val = ST_MarkerStyle.none;

                CT_AxDataSource catDS = ctLineSer.AddNewCat();

                XSSFChartUtil.BuildAxDataSource(catDS, categories);
                CT_NumDataSource valueDS = ctLineSer.AddNewVal();

                XSSFChartUtil.BuildNumDataSource(valueDS, values);

                if (IsTitleSet)
                {
                    ctLineSer.tx = GetCTSerTx();
                }

                if (fillColor != null)
                {
                    ctLineSer.spPr = new OpenXmlFormats.Dml.Chart.CT_ShapeProperties();
                    CT_LineProperties           ctLineProperties           = ctLineSer.spPr.AddNewLn();
                    CT_SolidColorFillProperties ctSolidColorFillProperties = ctLineProperties.AddNewSolidFill();
                    CT_SRgbColor ctSRgbColor = ctSolidColorFillProperties.AddNewSrgbClr();
                    ctSRgbColor.val = fillColor;
                }
            }
示例#3
0
            internal void AddToChart(CT_ScatterChart ctScatterChart)
            {
                CT_ScatterSer ctScatterSer = ctScatterChart.AddNewSer();

                ctScatterSer.AddNewIdx().val   = (uint)this.id;
                ctScatterSer.AddNewOrder().val = (uint)this.order;
                XSSFChartUtil.BuildAxDataSource <Tx>(ctScatterSer.AddNewXVal(), this.xs);
                XSSFChartUtil.BuildNumDataSource <Ty>(ctScatterSer.AddNewYVal(), this.ys);
            }
示例#4
0
            internal void AddToChart(CT_ScatterChart ctScatterChart)
            {
                CT_ScatterSer scatterSer = ctScatterChart.AddNewSer();

                scatterSer.AddNewIdx().val   = (uint)this.id;
                scatterSer.AddNewOrder().val = (uint)this.order;

                CT_AxDataSource xVal = scatterSer.AddNewXVal();

                XSSFChartUtil.BuildAxDataSource <Tx>(xVal, xs);
                CT_NumDataSource yVal = scatterSer.AddNewYVal();

                XSSFChartUtil.BuildNumDataSource <Ty>(yVal, ys);

                if (IsTitleSet)
                {
                    scatterSer.tx = this.GetCTSerTx();
                }
            }
            internal void AddToChart(CT_LineChart ctLineChart)
            {
                CT_LineSer ctLineSer = ctLineChart.AddNewSer();

                ctLineSer.AddNewIdx().val   = (uint)id;
                ctLineSer.AddNewOrder().val = (uint)order;

                // No marker symbol on the chart line.
                ctLineSer.AddNewMarker().AddNewSymbol().val = ST_MarkerStyle.none;

                CT_AxDataSource catDS = ctLineSer.AddNewCat();

                XSSFChartUtil.BuildAxDataSource(catDS, categories);
                CT_NumDataSource valueDS = ctLineSer.AddNewVal();

                XSSFChartUtil.BuildNumDataSource(valueDS, values);

                if (IsTitleSet)
                {
                    ctLineSer.tx = GetCTSerTx();
                }
            }
示例#6
0
            internal void AddToChart(CT_BarChart ctBarChart)
            {
                CT_BarSer      ctBarSer   = ctBarChart.AddNewSer();
                CT_BarGrouping ctGrouping = ctBarChart.AddNewGrouping();

                ctGrouping.val = ST_BarGrouping.clustered;
                ctBarSer.AddNewIdx().val        = (uint)id;
                ctBarSer.AddNewOrder().val      = (uint)order;
                CT_Boolean ctNoInvertIfNegative = new CT_Boolean();

                ctNoInvertIfNegative.val  = 0;
                ctBarSer.invertIfNegative = ctNoInvertIfNegative;

                CT_BarDir ctBarDir = ctBarChart.AddNewBarDir();

                ctBarDir.val = ST_BarDir.col;

                CT_AxDataSource catDS = ctBarSer.AddNewCat();

                XSSFChartUtil.BuildAxDataSource(catDS, categories);
                CT_NumDataSource valueDS = ctBarSer.AddNewVal();

                XSSFChartUtil.BuildNumDataSource(valueDS, values);

                if (IsTitleSet)
                {
                    ctBarSer.tx = GetCTSerTx();
                }

                if (fillColor != null)
                {
                    ctBarSer.spPr = new OpenXmlFormats.Dml.Chart.CT_ShapeProperties();
                    CT_SolidColorFillProperties ctSolidColorFillProperties = ctBarSer.spPr.AddNewSolidFill();
                    CT_SRgbColor ctSRgbColor = ctSolidColorFillProperties.AddNewSrgbClr();
                    ctSRgbColor.val = fillColor;
                }
            }