org.silverpeas.chart.period
Class PeriodChart

java.lang.Object
  extended by org.silverpeas.chart.AbstractChart<ITEM_TYPE>
      extended by org.silverpeas.chart.AbstractAxisChart<Period,Number,PeriodChartItem>
          extended by org.silverpeas.chart.period.PeriodChart
All Implemented Interfaces:
Chart<PeriodChartItem>

public class PeriodChart
extends AbstractAxisChart<Period,Number,PeriodChartItem>

Author:
Yohann Chastagnier

Method Summary
protected  void computeExtraDataAsJson(org.json.JSONObject jsonChart)
          Overriding this method if necessary.
 PeriodChartItem forX(Date dateReference, PeriodType periodType)
          Adds a value associated to a period.
 PeriodChartItem forX(Period period)
          Creates or gets the item associated to the given x value.
static PeriodChart fromTitle(String title)
          Initializes a new chart with the specified title that will provides the data in order to display them on a temporal graphic.
 PeriodType getDefaultPeriodType()
          Gets the default period type.
 ChartType getType()
          Gets the type of chart.
 PeriodChart setDefaultPeriodType(PeriodType defaultPeriodType)
          Sets the default period type.
static PeriodChart withoutTitle()
          Initializes a new chart without title that will provides the data in order to display them on a temporal graphic.
 
Methods inherited from class org.silverpeas.chart.AbstractAxisChart
add, getAxisX, getAxisY, getItemFrom
 
Methods inherited from class org.silverpeas.chart.AbstractChart
addExtra, asJson, getExtra, getItems, getTitle, withTitle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

fromTitle

public static PeriodChart fromTitle(String title)
Initializes a new chart with the specified title that will provides the data in order to display them on a temporal graphic.

Parameters:
title - the main title of the chart.
Returns:
a new instance of PeriodChart.

withoutTitle

public static PeriodChart withoutTitle()
Initializes a new chart without title that will provides the data in order to display them on a temporal graphic.

Returns:
a new instance of PeriodChart.

getType

public ChartType getType()
Description copied from interface: Chart
Gets the type of chart.

Returns:
the ChartType.

getDefaultPeriodType

public PeriodType getDefaultPeriodType()
Gets the default period type.

Returns:
the default PeriodType.

setDefaultPeriodType

public PeriodChart setDefaultPeriodType(PeriodType defaultPeriodType)
Sets the default period type.

Parameters:
defaultPeriodType - the default period type.
Returns:
the instance of the chart itself.

computeExtraDataAsJson

protected void computeExtraDataAsJson(org.json.JSONObject jsonChart)
Description copied from class: AbstractChart
Overriding this method if necessary.

Overrides:
computeExtraDataAsJson in class AbstractAxisChart<Period,Number,PeriodChartItem>
Parameters:
jsonChart - the json object that represents the chart.

forX

public PeriodChartItem forX(Date dateReference,
                            PeriodType periodType)
Adds a value associated to a period. The PeriodType of the period must not be PeriodType.unknown.

Parameters:
dateReference - a date of reference.
periodType - the period to represents.
Returns:
the PeriodChartItem that represents the given values.

forX

public PeriodChartItem forX(Period period)
Description copied from class: AbstractAxisChart
Creates or gets the item associated to the given x value.

Overrides:
forX in class AbstractAxisChart<Period,Number,PeriodChartItem>
Parameters:
period - the x value.
Returns:


Copyright © 2016 Silverpeas. All Rights Reserved.