ceTe Software Help Library for Java August - 2020
DynamicPDF Generator for Java / Programming with Generator for Java / Charts / Chart Elements / Stacked Series
In This Topic
    Stacked Series
    In This Topic

    A StackedSeries is a collection of values to be displayed on a graph. When multiple Stacked Series are added to the same PlotArea, values for a particular index (on any indexed stacked series) or a particular point in time (on any date-time stacked series) will literally be stacked on top of each other. There are four different groups of Stacked Series corresponding to the four different types of stacked charts (stacked area, stacked bar, stacked column and stacked line).  Each stacked series group will have both an indexed and a date-time type.  Stacked Pie and Scatter charts do not exist.


    Stacked Area Series
    Stacked Bar Series
    Stacked Column Series
    Stacked Line Series

    Stacked Area Series

    An Area chart has two types of stacked series:

    • DateTimeStackedAreaSeries
    This is a collection of DateTimeStackedAreaSeriesElement each corresponding to a particular point in time that will be plotted as a Stacked Area chart. A DateTimeStackedAreaSeries uses DateTimeXAxis as the XAxis type and NumericYAxis as the YAxis type. It uses the Calendar class for setting the time portion of the values in the series.
    The below code shows how to create and add elements to a DateTimeStackedAreaSeries.
    [Java]  
         DateTimeStackedAreaSeries stackedAreaSeries = new DateTimeStackedAreaSeries();
         Calendar p0=Calendar.getInstance();
         p0.set(2004,0,1);
         Calendar p1=Calendar.getInstance();
         p1.set(2004,1,1);
         Calendar p2=Calendar.getInstance();
         p2.set(2004,2,1);
         DateTimeStackedAreaSeriesElement areaSeriesElement1 = new DateTimeStackedAreaSeriesElement("Website A");
         areaSeriesElement1.getValues().add(51, p0);
         areaSeriesElement1.getValues().add(99, p1);
         areaSeriesElement1.getValues().add(42, p2);
         DateTimeStackedAreaSeriesElement areaSeriesElement2 = new DateTimeStackedAreaSeriesElement("Website B");
         areaSeriesElement2.getValues().add(11, p0);
         areaSeriesElement2.getValues().add(30, p1);
         areaSeriesElement2.getValues().add(22, p2);
         stackedAreaSeries.Add(areaSeriesElement1);
         stackedAreaSeries.Add(areaSeriesElement2);
    
    • IndexedStackedAreaSeries
    This is a collection of IndexedStackedAreaSeriesElement that will be plotted as a StackedAreaSeries in indexed order.  An IndexedStackedAreaSeries uses an IndexedXAxis as the XAxis type and a NumericYAxis as the YAxis type.
    The below code shows how to create and add elements to an IndexedStackedAreaSeries.
    [Java]     
          IndexedStackedAreaSeries areaSeries = new IndexedStackedAreaSeries();
          IndexedStackedAreaSeriesElement seriesElement1 = new IndexedStackedAreaSeriesElement("Website A");
          seriesElement1.getValues().add(new float[] { 5, 7, 9, 6 });
          IndexedStackedAreaSeriesElement seriesElement2 = new IndexedStackedAreaSeriesElement("Website B");
          seriesElement2.getValues().add(new float[] { 4, 2, 5, 8 });
          areaSeries.add(seriesElement1);
          areaSeries.add(seriesElement2);
    

    Stacked Bar Series

    A Bar chart has two types of stacked series:

    • DateTimeStackedBarSeries
    This is a collection of DateTimeStackedBarSeriesElement each corresponding to a particular point in time that will be plotted as a Stacked Bar chart. A DateTimeStackedBarSeries uses DateTimeXAxis as the XAxis type and NumericYAxis as the YAxis type. It uses the Calendar class for setting the time portion of the values in the series.
    The below code shows how to create and add elements to a DateTimeStackedBarSeries.
    [Java]  
          DateTimeStackedBarSeries stackedBarSeries = new DateTimeStackedBarSeries();
          Calendar p0=Calendar.getInstance();
          p0.set(2004,0,1);
          Calendar p1=Calendar.getInstance();
          p1.set(2004,1,1);
          Calendar p2=Calendar.getInstance();
          p2.set(2004,2,1);
          DateTimeStackedBarSeriesElement barSeriesElement1 = new DateTimeStackedBarSeriesElement("Website A");
          barSeriesElement1.getValues().add(51, p0);
          barSeriesElement1.getValues().add(99, p1);
          barSeriesElement1.getValues().add(42, p2);
          DateTimeStackedBarSeriesElement barSeriesElement2 = new DateTimeStackedBarSeriesElement("Website B");
          barSeriesElement2.getValues().add(11, p0);
          barSeriesElement2.getValues().add(30, p1);
          barSeriesElement2.getValues().add(22, p2);
          stackedBarSeries.add(barSeriesElement1);
          stackedBarSeries.add(barSeriesElement2);
    
    • IndexedStackedBarSeries
    This is a collection of IndexedStackedBarSeriesElement that will be plotted as a StackedBarSeries in indexed order.  An IndexedStackedBarSeries uses an IndexedXAxis as the XAxis type and a NumericYAxis as the YAxis type.
    The below code shows how to create and add elements to an IndexedStackedBarSeries.
    [Java]     
         IndexedStackedBarSeries barSeries = new IndexedStackedBarSeries();
         IndexedStackedBarSeriesElement seriesElement1 = new IndexedStackedBarSeriesElement("Website A");
         seriesElement1.getValues().add(new float[] { 5, 7, 9, 6 });
         IndexedStackedBarSeriesElement seriesElement2 = new IndexedStackedBarSeriesElement("Website B");
         seriesElement2.getValues().add(new float[] { 4, 2, 5, 8 });
         barSeries.add(seriesElement1);
         barSeries.add(seriesElement2); 
    

    Stacked Column Series

    A Column chart has two types of stacked series:

    • DateTimeStackedColumnSeries
    This is a collection of DateTimeStackedColumnSeriesElement each corresponding to a particular point in time that will be plotted as a Stacked Column chart. A DateTimeStackedColumnSeries uses DateTimeXAxis as the XAxis type and NumericYAxis as the YAxis type. It uses the Calendar class for setting the time portion of the values in the series.
    The below code shows how to create and add elements to a DateTimeStackedColumnSeries.
    [Java]  
         DateTimeStackedColumnSeries stackedColumnSeries = new DateTimeStackedColumnSeries();
         Calendar p0=Calendar.getInstance();
         p0.set(2004,0,1);
         Calendar p1=Calendar.getInstance();
         p1.set(2004,1,1);
         Calendar p2=Calendar.getInstance();
         p2.set(2004,2,1);
         DateTimeStackedColumnSeriesElement columnSeriesElement1 = new DateTimeStackedColumnSeriesElement("Website A");
         columnSeriesElement1.getValues().add(51, p0);
         columnSeriesElement1.getValues().add(99, p1);
         columnSeriesElement1.getValues().add(42, p2);
         DateTimeStackedColumnSeriesElement columnSeriesElement2 = new DateTimeStackedColumnSeriesElement("Website B");
         columnSeriesElement2.getValues().add(11, p0);
         columnSeriesElement2.getValues().add(30, p1);
         columnSeriesElement2.getValues().add(22, p2);
         stackedColumnSeries.Add(columnSeriesElement1);
         stackedColumnSeries.Add(columnSeriesElement2);
    
    • IndexedStackedColumnSeries
    This is a collection of IndexedStackedColumnSeriesElement that will be plotted as a StackedColumnSeries in indexed order.  An IndexedStackedColumnSeries uses an IndexedXAxis as the XAxis type and a NumericYAxis as the YAxis type.
    The below code shows how to create and add elements to an IndexedStackedColumnSeries.
    [Java]     
          IndexedStackedColumnSeries columnSeries = new IndexedStackedColumnSeries();
          IndexedStackedColumnSeriesElement seriesElement1 = new IndexedStackedColumnSeriesElement("Website A");
          seriesElement1.getValues().add(new float[] { 5, 7, 9, 6 });
          IndexedStackedColumnSeriesElement seriesElement2 = new IndexedStackedColumnSeriesElement("Website B");
          seriesElement2.getValues().add(new float[] { 4, 2, 5, 8 });
          columnSeries.add(seriesElement1);
          columnSeries.add(seriesElement2); 
    

    Stacked Line Series

    A Line chart has two types of stacked series:

    • DateTimeStackedLineSeries
    This is a collection of DateTimeStackedLineSeriesElement each corresponding to a particular point in time that will be plotted as a Stacked Line chart. A DateTimeStackedLineSeries uses DateTimeXAxis as XAxis type and NumericYAxis as the YAxis type. It uses the Calendar class for setting the time portion of the values in the series.
    The below code shows how to create and add elements to a DateTimeStackedLineSeries.
    [Java]  
         DateTimeStackedLineSeries stackedLineSeries = new DateTimeStackedLineSeries();
         Calendar p0=Calendar.getInstance();
         p0.set(2004,0,1);
         Calendar p1=Calendar.getInstance();
         p1.set(2004,1,1);
         Calendar p2=Calendar.getInstance();
         p2.set(2004,2,1);
         DateTimeStackedLineSeriesElement lineSeriesElement1 = new DateTimeStackedLineSeriesElement("Website A");
         lineSeriesElement1.getValues().add(51, p0);
         lineSeriesElement1.getValues().add(99, p1);
         lineSeriesElement1.getValues().add(42, p2);
         DateTimeStackedLineSeriesElement lineSeriesElement2 = new DateTimeStackedLineSeriesElement("Website B");
         lineSeriesElement2.getValues().add(11, p0);
         lineSeriesElement2.getValues().add(30, p1);
         lineSeriesElement2.getValues().add(22, p2);
         stackedLineSeries.add(lineSeriesElement1);
         stackedLineSeries.add(lineSeriesElement2);
    
    • IndexedStackedLineSeries
    This is a collection of IndexedStackedLineSeriesElement that will be plotted as a StackedLineSeries in indexed order.  An IndexedStackedLineSeries uses an IndexedXAxis as the XAxis type and a NumericYAxis as the YAxis type.
    The below code shows how to create and add elements to an IndexedStackedLineSeries.
    [Java]     
         IndexedStackedLineSeries lineSeries = new IndexedStackedLineSeries();
         IndexedStackedLineSeriesElement seriesElement1 = new IndexedStackedLineSeriesElement("Website A");
         seriesElement1.getValues().add(new float[] { 5, 7, 9, 6 });
         IndexedStackedLineSeriesElement seriesElement2 = new IndexedStackedLineSeriesElement("Website B");
         seriesElement2.getValues().add(new float[] { 4, 2, 5, 8 });
         lineSeries.add(seriesElement1);
         lineSeries.add(seriesElement2);
    
    See Also