Bridges-Java  3.4.4-dev2-4-g23cf54b
Bridges(Java API)
Classes | Public Member Functions | List of all members
bridges.base.BarChart Class Reference

Support for drawing Bar charts. More...

Inheritance diagram for bridges.base.BarChart:
bridges.base.DataStruct

Classes

class  Pair
 

Public Member Functions

 BarChart ()
 Line chart default constructor. More...
 
String getDataStructType ()
 gets the data type More...
 
void setTitle (String t)
 Title of the plot. More...
 
String getTitle ()
 Title of the plot. More...
 
void setSubTitle (String s)
 Subtitle of the plot. More...
 
String getSubTitle ()
 Subtitle of the plot. More...
 
void setCategoriesLabel (String cAxisName)
 Change the category axis label. More...
 
String getCategoriesLabel ()
 Returns the label for the category axis. More...
 
void setValueLabel (String vAxisName)
 Change the label for the value axis. More...
 
String getValueLabel ()
 Returns the label for the vlue axis. More...
 
void setBarOrientation (String orient)
 sets the bar chart orientation More...
 
String getBarOrientation ()
 gets the bar chart orientation More...
 
void setTooltipSuffix (String suffix)
 sets the tooltip suffix More...
 
String getTooltipSuffix ()
 gets the tooltip suffix More...
 
void setCategories (Vector< String > categories)
 set the category labels for this bar chart More...
 
void addDataSeries (String seriesName, double[] data)
 Add a series of data. More...
 
String getDataStructureRepresentation ()
 get the data structure representation as a JSON More...
 

Additional Inherited Members

- Protected Attributes inherited from bridges.base.DataStruct
String QUOTE = "\""
 
- Package Attributes inherited from bridges.base.DataStruct
String COMMA = ","
 
String COLON = ":"
 
String OPEN_CURLY = "{"
 
String CLOSE_CURLY = "}"
 
String OPEN_PAREN = "("
 
String CLOSE_PAREN = ")"
 
String OPEN_BOX = "["
 
String CLOSE_BOX = "]"
 

Detailed Description

Support for drawing Bar charts.

Bar charts (https://en.wikipedia.org/wiki/Bar_chart) are used to represent categorical data as a series of rectangular bars with length proportional to the values they represent.

Series in a bar chart provides data for a number of categories (sometimes called bins). Categories are defined using setCategories() and the series are added using addDataSeries(). The series are rendered in the order in which they were added. Once a series has been added, it can not be modified.

One should always define the categories before adding data. Changing the categories after series have been added will throw exceptions; adding series with different number of values than the number of categories will throw an exception.

The Bar charts can have a title, subtitle. The charts can be horizontal or vertically oriented, using setBarOrientation().

A tooltip indicating the value of a series in a particular bin is displayed by hovering on a bar. One can append a string to the value using setTooltipSuffix() to specify units in the tooltip if desired.

See also
See tutorial on using BarChart at: https://bridgesuncc.github.io/tutorials/BarChart.html
Author
Kalpathi Subramanian, Erik Saule
Date
09/15/24

Constructor & Destructor Documentation

◆ BarChart()

bridges.base.BarChart.BarChart ( )

Line chart default constructor.

Member Function Documentation

◆ addDataSeries()

void bridges.base.BarChart.addDataSeries ( String  seriesName,
double[]  data 
)

Add a series of data.

This will throw an exception if the data vector does not have the same size as the number of categories.

This will throw exceptions if two series have the same name.

Parameters
seriesNameindicates the name of the data to add
datavalues of that serie for each category

◆ getBarOrientation()

String bridges.base.BarChart.getBarOrientation ( )

gets the bar chart orientation

Returns
orientation (either "horizontal" or "vertical")

◆ getCategoriesLabel()

String bridges.base.BarChart.getCategoriesLabel ( )

Returns the label for the category axis.

Returns
label shown for the category axis

◆ getDataStructType()

String bridges.base.BarChart.getDataStructType ( )

gets the data type

Returns
data type of the bar chart

Reimplemented from bridges.base.DataStruct.

◆ getDataStructureRepresentation()

String bridges.base.BarChart.getDataStructureRepresentation ( )

get the data structure representation as a JSON

Reimplemented from bridges.base.DataStruct.

◆ getSubTitle()

String bridges.base.BarChart.getSubTitle ( )

Subtitle of the plot.

Returns
the subtitle to be shown

◆ getTitle()

String bridges.base.BarChart.getTitle ( )

Title of the plot.

Returns
the title to be shown

◆ getTooltipSuffix()

String bridges.base.BarChart.getTooltipSuffix ( )

gets the tooltip suffix

Returns
suffix

◆ getValueLabel()

String bridges.base.BarChart.getValueLabel ( )

Returns the label for the vlue axis.

Returns
label shown for the value axis

◆ setBarOrientation()

void bridges.base.BarChart.setBarOrientation ( String  orient)

sets the bar chart orientation

Bar charts can be "horizontal" or "vertical". Throws exception on other values.

Parameters
orient

◆ setCategories()

void bridges.base.BarChart.setCategories ( Vector< String >  categories)

set the category labels for this bar chart

Will throw an exception if there are already data series defined.

Parameters
categoriesthe name of each category

◆ setCategoriesLabel()

void bridges.base.BarChart.setCategoriesLabel ( String  cAxisName)

Change the category axis label.

Parameters
cAxisNamelabel to show for the category axis

◆ setSubTitle()

void bridges.base.BarChart.setSubTitle ( String  s)

Subtitle of the plot.

Parameters
sthe subtitle to be shown

◆ setTitle()

void bridges.base.BarChart.setTitle ( String  t)

Title of the plot.

Parameters
tthe title to be shown

◆ setTooltipSuffix()

void bridges.base.BarChart.setTooltipSuffix ( String  suffix)

sets the tooltip suffix

This appends a string to the values in the hover tooltip.

Parameters
suffix

◆ setValueLabel()

void bridges.base.BarChart.setValueLabel ( String  vAxisName)

Change the label for the value axis.

Parameters
yaxisNamelabel to use for the value axis

The documentation for this class was generated from the following file: