Chart FX 7 for Java Server

com.softwarefx.chartfx.server
Class DataValues

java.lang.Object
  extended by com.softwarefx.chartfx.server.DataValues

public class DataValues
extends Object

Provides access to the DataValues object which is the key component to pass data to the chart.

You can also assign x-values to create an XY Plot using the getX() property.

You can set initial values using the getYFrom() property. Used in conjunction with the getY() property, you can create a 'floating bars' effect for bar charts.

Many times charts contain a large amount of data whereby visualizing such data via a chart has little or no value. For example, you may have the number of sales per day for all 365 days of the year however seeing a trend from month to month is very difficult due to the busy and excess information in the chart. Instead you can use ChartFX Data Compacting feature to provide meaningful summarized data. For convenience, ChartFX provides predefined formulas for popular compacting schemes such as First, Last, Min, Max, and Average.

Please note that instead of the value associated with the point, you can assign a hidden constant which will cause the point to be hidden in the chart. Although a hidden point is physically in the data array, when you use this constant the marker will not appear in the chart, and if you have charts like a line or area chart, the line will break at that particular point.


Field Summary
static double HIDDEN
           
 
Constructor Summary
DataValues()
           
 
Method Summary
 void clear()
          Clears all the data values in the chart.
 boolean commitChanges()
          Finalizes chart data and invokes selected data related tasks.
 void compact(double step)
          Compacts the data in order to display more summarized information.
 double get(int series, int point)
          Returns the element at the specified position in the DataValues.
 double getCompactedBy()
          Gets the CompactedBy.
 LabelCollection getLabels()
          Provides access to label collection of the Chart.getAxisX().
 int getPoints()
          Gets the Points.
 int getSeries()
          Gets the Series.
 IDataArray getX()
          Allows you to set X-Values for specific point of XY plots.
 IDataArray getY()
          Allows you to access the Y coordinates of the data points.
 IDataArray getYFrom()
          Allows you to set the starting Y-value for a specific value on the chart.
 boolean isAggressiveAllocation()
          Gets the AggressiveAllocation.
 boolean isCompacted()
          Gets a value indicating whether or not the data is compacted.
 boolean isInitializeHidden()
          Gets the InitializeHidden.
 boolean isInterpolateHidden()
          Gets the InterpolateHidden.
 void recalculateScale()
          Recalculates the scale of the chart based on the data available.
 void removeSeries(int seriesIndex)
          Remove a Series from the collection by index.
 void set(int series, int point, double value)
          Replaces the element at the specified position in the DataValues collection with the specified element.
 void setAggressiveAllocation(boolean value)
          Sets a value indicating ChartFX should agreesively allocate space for future values.
 void setCompactedBy(double value)
          Sets a value indicating the interval of units to compress data.
 void setInitializeHidden(boolean value)
          Sets a value indicating to intialize all non-initialized values to hidden value.
 void setInterpolateHidden(boolean value)
          Sets a value specifying to draw a connecting line over a missing data point.
 void setPoints(int value)
          Sets a value indicating the number of series allocated for the chart.
 void setSeries(int value)
          Sets a value indicating the number of series allocated for the chart.
 void undoCompact()
          If the data is compacted, this method uncompacts the data and shows all values.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HIDDEN

public static final double HIDDEN
See Also:
Constant Field Values
Constructor Detail

DataValues

public DataValues()
Method Detail

clear

public void clear()

Clears all the data values in the chart.

Remarks:
  • After calling the values, the chart displays a message:


  • commitChanges

    public boolean commitChanges()

    Finalizes chart data and invokes selected data related tasks.

    Remarks:
  • This method should not be required for normal chart generation, however it was found that it was useful in selected scenarios. This method instructs the chart to:

    1) Compact data if Data Compaction features are used.

    2) Equalizes Point and Series allocations.

    3) Axis adjustments based on data.

    These tasks will also be completed before the chart is rendered, however using this method developers may force this to occur on demand.

  • This method also returns a boolean value specifying if this has been completed.

  • See Also:
    Chart.getData()

    compact

    public void compact(double step)

    Compacts the data in order to display more summarized information.

    Remarks:
  • By default, Chart FX utilizes the CompactFormulas.Min.

  • When compacting data, the data will require summarization of some form. Chart FX allows you to specify how to summarize data in the form of a DataCompacting formula. For convenience, Chart FX provides predefined formulas for popular compacting schemes such as First, Last, Min, Max, and Average.

  • Here is a sample how to compact 10 bars into 2 by grouping them into 1 bar for every 5 bars. By default, Chart FX utilizes the CompactFormulas.Min.

    Here is the original chart for the sample chart of 1 series and 10 points:

    After calling the Compact method with a step set to two (2), the result chart provides summarized data compacting every two bars into one and producing a new bar which is the minimum Y value of both bars:

    Similarly, this is the resulting chart when the step is set to four (5) and the CompactFormula is set to Max:

  • From time to time, the developer requires specific analysis and summarization of data not available through one of the predefined formulas. For this, Chart FX provides the ability for specifying a custom formula to use when compacting data allowing unlimited possibilities for summarizing your compacted data. Chart FX provides a way for the developer to delegate the computation to a specific handling function.

    Below is a chart which uses a custom handler to sum the values to be compacted. The step is set to 2:

  • The undoCompact() method is used to decompress compacted data and show all values.

  • The Chart.getData() method is used to access the DataValues object for a chart.

  • Parameters:
    step - The number of points to agregate while compacting data.
    See Also:
    isCompacted(), setCompactedBy(double), Chart.getData(), undoCompact(), Chart

    get

    public double get(int series,
                      int point)

    Returns the element at the specified position in the DataValues.

    Parameters:
    series - Index of the series to return.
    point - Index of the point to return.

    getCompactedBy

    public double getCompactedBy()

    Gets the CompactedBy. For more detail see setCompactedBy(double).


    getLabels

    public LabelCollection getLabels()

    Provides access to label collection of the Chart.getAxisX().

    Remarks:
  • Provides a shortcut to the Axis.getLabels()method of the main Chart.getAxisX()of the Chart.

  • Below, the labels of the x-axis are formatted in a way that the value of each label is set to the string "Label" and the point index that is labeled:

  • See Also:
    Axis.getLabels(), Chart.getAxisX(), AxisX

    getPoints

    public int getPoints()

    Gets the Points. For more detail see setPoints(int).


    getSeries

    public int getSeries()

    Gets the Series. For more detail see setSeries(int).


    getX

    public IDataArray getX()

    Allows you to set X-Values for specific point of XY plots.

    Remarks:
  • This following chart initializes both the X and Y method in order to render a XY plot:

  • See Also:
    getY(), getYFrom()

    getY

    public IDataArray getY()

    Allows you to access the Y coordinates of the data points.

    Remarks:
  • This following chart initializes both the X and Y methods in order to render a XY scatter chart:

  • See Also:
    getX(), getYFrom()

    getYFrom

    public IDataArray getYFrom()

    Allows you to set the starting Y-value for a specific value on the chart.

    Remarks:
  • This method is usefull for specific galleries such as Gantt. In this situation, the YFrom value can been seen as the starting point of the task, and the Y value can be seen as the ending point of the task:

  • See Also:
    getX(), getY()

    isAggressiveAllocation

    public boolean isAggressiveAllocation()

    Gets the AggressiveAllocation. For more detail see setAggressiveAllocation(boolean).


    isCompacted

    public boolean isCompacted()

    Gets a value indicating whether or not the data is compacted.

    Remarks:
  • The data compression features provide developers with a mechanism to display data in different intervals, summarizing historical data. The compact(double) method is used to complete the compacting process.

  • The undoCompact() method is used to decompress compacted data and show all values.

  • The setCompactedBy(double) method is used to configure a value indicating the interval of units to compress data.

  • The Chart.getData() method is used to access the DataValues object for a chart.

  • See Also:
    setCompactedBy(double), Chart.getData(), compact(double), undoCompact(), Chart

    isInitializeHidden

    public boolean isInitializeHidden()

    Gets the InitializeHidden. For more detail see setInitializeHidden(boolean).


    isInterpolateHidden

    public boolean isInterpolateHidden()

    Gets the InterpolateHidden. For more detail see setInterpolateHidden(boolean).


    recalculateScale

    public void recalculateScale()

    Recalculates the scale of the chart based on the data available.

    Remarks:
  • The Chart.recalculateScale()of the Chart Class is a shortcut to this method.

  • Please keep in mind that this method reads the entire data array, so abusing this method could affect the performance of your application, as Chart FX will read the entire data array every time this method is called.

  • This method should be invoked to force Chart FX to calculate the Axis.setMin(double), Axis.setMax(double), Axis.setMinorStep(double), and Axis.setStep(double)for the Axis.

  • This method will not affect the Axis.setStep(double)and Axis.setMinorStep(double)methods if they have been previously set. To make sure that they respond to this method, set the Axis.setStep(double)and Axis.setMinorStep(double)methods to zero (0).

  • A typical case of when to use this method is when you disable the Axis.setAutoScale(boolean)method to calculate the Axis.setMin(double)and Axis.setMax(double) methods and you set new data to the chart that causes the scale values to be recalculated to show the appropriate data.

  • When using a SeriesAttributes.setStacked(boolean)style chart, recalculating the scale will sometimes make the chart more readable.

  • See Also:
    Axis.setMin(double), Axis.setMax(double), Axis.setStep(double), Axis.setMinorStep(double), Axis.setAutoScale(boolean), SeriesAttributes.setStacked(boolean), Chart.recalculateScale(), Axis

    removeSeries

    public void removeSeries(int seriesIndex)

    Remove a Series from the collection by index.

    Remarks:
  • When a Series is removed from the collection using this method, all the indexes will be recalculated and the properties will remain associated with the old index. So if you assign properties to Series index 2, and then remove that series, Series index 3 (if it exists) will assume all the properties of old Series index 2 (including the index number).

  • Parameters:
    seriesIndex - Index of Series to be removed.

    set

    public void set(int series,
                    int point,
                    double value)

    Replaces the element at the specified position in the DataValues collection with the specified element.

    Parameters:
    series - Index of the series to set.
    point - Index of the point to set.
    value - The item to add to the DataValues collection

    setAggressiveAllocation

    public void setAggressiveAllocation(boolean value)

    Sets a value indicating ChartFX should agreesively allocate space for future values. This increases performance at the cost of additional memory usage.

    Remarks:
  • When set to True, Chart FX will double the current memory allotment when it is required allocate additional memory for the chart's data array. This is the default behavior. When set to False, memory is allocated in single units.

  • AggressiveAllocation should only become a factor when dealing with very large amounds of data (millions).

  • The Chart.getData() method of the Chart object is used to access the DataValues object of a chart.

  • See Also:
    setPoints(int), Chart.getData(), Chart

    setCompactedBy

    public void setCompactedBy(double value)

    Sets a value indicating the interval of units to compress data.

    Remarks:
  • This method is used to configure the units for compression in the X Axis. If the XAxis has been passed DateTime XValues and has been formated for Date, the units represented by the CompactBy method would be Days. For example a value of 30 would be interperted into 1 Month. If you do not have configured XValues in the chart, then the unit base is 1 (categorical axis).

  • The data compression features provide developers with a mechanism to display data in different intervals, summarizing historical data. The compact(double) method is used to complete the compacting process.

  • The isCompacted() returns a value indicating whether or not the data is compacted.

  • The undoCompact() method is used to decompress compacted data and show all values.

  • The Chart.getData() method is used to access the DataValues object for a chart.

  • See Also:
    isCompacted(), Chart.getData(), compact(double), Chart

    setInitializeHidden

    public void setInitializeHidden(boolean value)

    Sets a value indicating to intialize all non-initialized values to hidden value.

    Remarks:
  • In this chart, InitializeHidden has been set to false. Only point 4 and 6 have been initialized. Notice that the other points are set to zero:

    Alternatively, InitializeHidden is here set to true. Notice that all the points except 4 and 6 are not rendered (i.e., they are hidden):

  • This method will affect the data points which will be allocated, not the data points which are already allocated.


  • setInterpolateHidden

    public void setInterpolateHidden(boolean value)

    Sets a value specifying to draw a connecting line over a missing data point.

    Remarks:
  • When this method is set to false, hidden points in the chart will be result in a "broken" line in the chart. When set to true, the chart will draw a connecting so prevent the broken line.

  • In previous versions of Chart FX, it was not possible to create charts which markers where not evenly spaced without passing both X and Y data. The InterpolateHidden method now makes it possible to create non even spaced charts with only Y values.

  • The setInitializeHidden(boolean) method is used to instruct the chart to intialize all non-initialized values to a hidden value.

  • See Also:
    setInitializeHidden(boolean)

    setPoints

    public void setPoints(int value)

    Sets a value indicating the number of series allocated for the chart.

    Remarks:
  • The Points and setSeries(int) methods are usually set a design-time using the method dialog box for the Chart object. The only time these methods should be included in code is when you wish to read the number of series or points in a chart.

  • This methody is normally used to get the number of data points per series available in the chart for administration purposes. For example, if you want to change the values of each data point in a series, you will need the number of available points per series to complete the For loop.

  • Below, the chart has 2 series and 5 points per series:

  • See Also:
    setSeries(int)

    setSeries

    public void setSeries(int value)

    Sets a value indicating the number of series allocated for the chart.

    Remarks:
  • The setPoints(int) and Series methods are usually set a design-time using the property dialog box for the Chart object. The only time these methods should be included in code is when you wish to read the number of series or points in a chart.

  • This method is normally used to get the number of series available on the chart for administration purposes. For example, if you want to set a different color for each data series using the PointAttributes.setColor(java.awt.Color)method, you will need the number of available data series to complete the For loop.

  • Below, the chart has five series and two points per series:

  • See Also:
    setPoints(int)

    undoCompact

    public void undoCompact()

    If the data is compacted, this method uncompacts the data and shows all values.

    Remarks:
  • The data compression features provide developers with a mechanism to display data in different intervals, summarizing historical data. The compact(double) method is used to complete the compacting process.

  • The isCompacted() returns a value indicating whether or not the data is compacted.

  • The Chart.getData() method is used to access the DataValues object for a chart.

  • See Also:
    isCompacted(), setCompactedBy(double), Chart.getData(), compact(double), Chart

    http://www.softwarefx.com

    2008 Software FX, Inc. All Rights Reserved. Chart FX is a registered trademark of Software FX, Inc
    All other names are trademarks or registered trademarks of their respective owners.