示例#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
 public static void BuildNumDataSource <T>(CT_NumDataSource ctNumDataSource, IChartDataSource <T> dataSource)
 {
     if (dataSource.IsReference)
     {
         XSSFChartUtil.BuildNumRef <T>(ctNumDataSource.AddNewNumRef(), dataSource);
     }
     else
     {
         XSSFChartUtil.BuildNumLit <T>(ctNumDataSource.AddNewNumLit(), dataSource);
     }
 }
示例#5
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();
                }
            }
示例#7
0
 public static void BuildAxDataSource <T>(CT_AxDataSource ctAxDataSource, IChartDataSource <T> dataSource)
 {
     if (dataSource.IsNumeric)
     {
         if (dataSource.IsReference)
         {
             XSSFChartUtil.BuildNumRef <T>(ctAxDataSource.AddNewNumRef(), dataSource);
         }
         else
         {
             XSSFChartUtil.BuildNumLit <T>(ctAxDataSource.AddNewNumLit(), dataSource);
         }
     }
     else if (dataSource.IsReference)
     {
         XSSFChartUtil.BuildStrRef <T>(ctAxDataSource.AddNewStrRef(), dataSource);
     }
     else
     {
         XSSFChartUtil.BuildStrLit <T>(ctAxDataSource.AddNewStrLit(), dataSource);
     }
 }
示例#8
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;
                }
            }
示例#9
0
 private static void BuildStrLit <T>(CT_StrData ctStrData, IChartDataSource <T> dataSource)
 {
     XSSFChartUtil.FillStringCache <T>(ctStrData, dataSource);
 }
示例#10
0
 private static void BuildStrRef <T>(CT_StrRef ctStrRef, IChartDataSource <T> dataSource)
 {
     ctStrRef.f = dataSource.FormulaString;
     XSSFChartUtil.FillStringCache <T>(ctStrRef.AddNewStrCache(), dataSource);
 }
示例#11
0
 private static void BuildNumLit <T>(CT_NumData ctNumData, IChartDataSource <T> dataSource)
 {
     XSSFChartUtil.FillNumCache <T>(ctNumData, dataSource);
 }
示例#12
0
 private static void BuildNumRef <T>(CT_NumRef ctNumRef, IChartDataSource <T> dataSource)
 {
     ctNumRef.f = dataSource.FormulaString;
     XSSFChartUtil.FillNumCache <T>(ctNumRef.AddNewNumCache(), dataSource);
 }