Example #1
0
        public void FillChart(IChart chart, IChartAxis[] axis)
        {
            if (!(chart is XSSFChart))
            {
                throw new ArgumentException("Chart must be instance of XSSFChart");
            }

            XSSFChart       xssfChart      = (XSSFChart)chart;
            CT_PlotArea     plotArea       = xssfChart.GetCTChart().plotArea;
            int             allSeriesCount = plotArea.GetAllSeriesCount();
            CT_ScatterChart scatterChart   = plotArea.AddNewScatterChart();

            AddStyle(scatterChart);

            for (int i = 0; i < series.Count; ++i)
            {
                Series s = (Series)series[i];
                s.SetId(allSeriesCount + i);
                s.SetOrder(allSeriesCount + i);
                s.AddToChart(scatterChart);
            }

            foreach (IChartAxis ax in axis)
            {
                scatterChart.AddNewAxId().val = (uint)ax.Id;
            }
        }
Example #2
0
        public void FillChart(SS.UserModel.IChart chart, params IChartAxis[] axis)
        {
            if (!(chart is XSSFChart))
            {
                throw new ArgumentException("Chart must be instance of XSSFChart");
            }

            XSSFChart   xssfChart      = (XSSFChart)chart;
            CT_PlotArea plotArea       = xssfChart.GetCTChart().plotArea;
            int         allSeriesCount = plotArea.GetAllSeriesCount();
            CT_BarChart barChart       = plotArea.AddNewBarChart();

            barChart.AddNewVaryColors().val = 0;

            for (int i = 0; i < series.Count; ++i)
            {
                Series s = (Series)series[i];
                s.SetId(allSeriesCount + i);
                s.SetOrder(allSeriesCount + i);
                s.AddToChart(barChart);
            }

            foreach (IChartAxis ax in axis)
            {
                barChart.AddNewAxId().val = (uint)ax.Id;
            }
        }