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

    A Series is a collection of values used to display an individual graph.  A Series is added to the Plot Area where it will be displayed. There are six different groups of Series corresponding to the six types of Charts.  Some Series groups have multiple types. 

    Area Series
    Bar Series
    Line Series
    Column Series
    XYScatter Series
    Pie Series

    Area Series

    An Area chart has two types of series:

    • DateTimeAreaSeries
    This is a collection of values each corresponding to a particular point in time that will be plotted as an Area chart. A DateTimeAreaSeries uses a DateTimeXAxis as the XAxis type and a NumericYAxis as the YAxis type.  It uses Calendar class for setting the time portion of the values in the series.

    The below code shows how to create and add values to a DateTimeAreaSeries.

    [Java]
        DateTimeAreaSeries areaSeries = new DateTimeAreaSeries("Website A");
        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);
        Calendar p3=Calendar.getInstance();
        p3.set(2004,3,1);
        areaSeries.getValues().add(521, p0);
        areaSeries.getValues().add(969, p1);
        areaSeries.getValues().add(452, p2);
        areaSeries.getValues().add(347, p3);
    
    • IndexedAreaSeries
    This is a collection of values to be plotted as an Area chart in indexed order. An IndexedAreaSeries uses an IndexedXAxis as the XAxis type and a NumericYAxis as the YAxis type.
    The below code shows how to create and add values to an IndexedAreaSeries.
    [Java] 
         IndexedAreaSeries areaSeries = new IndexedAreaSeries("Website A");
         areaSeries.getValues().add(521, 0);
         areaSeries.getValues().add(969, 1);
         areaSeries.getValues().add(451, 2);
         areaSeries.getValues().add(347, 3);
    

    Bar Series

    A Bar chart has two types of series:

    • DateTimeBarSeries
    This is a collection of values each corresponding to a particular point in time that will be plotted as a Bar chart. A DateTimeBarSeries uses a NumericXAxis as the XAxis type and a DateTimeYAxis as the YAxis type.  It uses theCalendar class for setting the time portion of the values in the series.

    The below code shows how to create and add values to a DateTimeBarSeries.

    [Java]
         DateTimeBarSeries barSeries = new DateTimeBarSeries("Website A");
         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);
         Calendar p3=Calendar.getInstance();
         p3.set(2004,3,1);
         barSeries.getValues().add(521, p0);
         barSeries.getValues().add(969, p1);
         barSeries.getValues().add(452, p2);
         barSeries.getValues().add(347, p3);
    
    • IndexedBarSeries
    This is a collection of values to be plotted as a Bar chart in indexed order.  An IndexedBarSeries uses a NumericXAxis as the XAxis type and a IndexedYAxis as the YAxis type.
    The below code shows how to create and add values to an IndexedBarSeries.
    [Java]   
         IndexedBarSeries barSeries = new IndexedBarSeries("Website A");      
         barSeries.getValues().add(521, 0);
         barSeries.getValues().add(969, 1);
         barSeries.getValues().add(451, 2);
         barSeries.getValues().add(347, 3);  
    

    Line Series

    A Line chart has two types of series:

    • DateTimeLineSeries
    This is a collection of values each corresponding to a particular point in time that will be plotted as a Line chart. A DateTimeLineSeries uses a DateTimeXAxis as the XAxis type and a 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 values to the DateTimeLineSeries.
    [Java]  
         DateTimeLineSeries lineSeries = new DateTimeLineSeries("Website A");
         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);
         Calendar p3=Calendar.getInstance();
         p3.set(2004,3,1);
         lineSeries.getValues().add(521, p0);
         lineSeries.getValues().add(969, p1);
         lineSeries.getValues().add(452, p2);
         lineSeries.getValues().add(347, p3);
    
    • IndexedLineSeries
    This is a collection of values to be plotted as a Line chart in indexed order. An IndexedLineSeries uses an IndexedXAxis as the XAxis type and a NumericYAxis as the YAxis type.
    The below code shows how to create and add values to an IndexedLineSeries.
    [Java]     
         IndexedLineSeries lineSeries = new IndexedLineSeries("Website A");      
         lineSeries.getValues().add(521, 0);
         lineSeries.getValues().add(969, 1);
         lineSeries.getValues().add(451, 2);
         lineSeries.getValues().add(347, 3);  
    

    Column Series

    A Column chart has two types of series:

    • DateTimeColumnSeries
    This is a collection of values each corresponding to a particular point in time that will be plotted as a Column chart. A DateTimeColumnSeries uses a DateTimeXAxis as the XAxis type and a 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 values to a DateTimeColumnSeries.

    [Java]  
         DateTimeColumnSeries columnSeries = new DateTimeColumnSeries("Website A");
         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);
         Calendar p3=Calendar.getInstance();
         p3.set(2004,3,1);
         columnSeries.getValues().add(521, p0);
         columnSeries.getValues().add(969, p1);
         columnSeries.getValues().add(452, p2);
         columnSeries.getValues().add(347, p3);
    
    • IndexedColumnSeries
    This is a collection of values to be plotted as a Column chart in indexed order. An IndexedColumnSeries uses an IndexedXAxis as the XAxis type and a NumericYAxis as the YAxis type.
    The below code shows how to create and add values to an IndexedColumnSeries.
    [Java]     
         IndexedColumnSeries columnSeries = new IndexedColumnSeries("Website A");      
         columnSeries.getValues().add(521, 0);
         columnSeries.getValues().add(969, 1);
         columnSeries.getValues().add(451, 2);
         columnSeries.getValues().add(347, 3);  
    

    XYScatter Series

    This is a collection of values to be plotted as an XYScatter chart. A XYScatterSeries uses a NumericXAxis as the XAxis type and a NumericYAxis as the YAxis type.

    The below code shows how to create and add values to a XYScatterSeries.

    [Java]
          XYScatterSeries xyScatterSeries = new XYScatterSeries("Server #1");
          xyScatterSeries.getValues().add(59,10);
          xyScatterSeries.getValues().add(75,15);
          xyScatterSeries.getValues().add(92,25);
          xyScatterSeries.getValues().add(63,30);
          xyScatterSeries.getValues().add(45,43);
    

    Pie Series

    This is a collection of values to be plotted as a Pie chart. A PieSeries does not use any XAxis or YAxis.

    The below code shows how to create and add values to a PieSeries.

    [Java] 
         PieSeries pieSeries = new PieSeries();       
         pieSeries.getElements().add(13,"Product A");
         pieSeries.getElements().add(13,"Product B");
         pieSeries.getElements().add(13,"Product C");
         pieSeries.getElements().add(13,"Product D");
         pieSeries.getElements().add(13,"Product E");   
    
    See Also