Bridges-Java  3.4.3
Bridges(Java API)
Public Member Functions | List of all members
bridges.base.LineChart Class Reference
Inheritance diagram for bridges.base.LineChart:
bridges.base.DataStruct

Detailed Description

Enable plotting series of data or functions using a line chart.

Line charts (https://en.wikipedia.org/wiki/Line_chart) are used to represent graphically functions such as f(x) = 3*x+1, or data such as temperature of a liquid on a stove as time passes. A individual function or a set of data are called "series".

A series is represented by two arrays xdata and ydata such that there is a point at (xdata[0], ydata[0]), an other at (xdata[1], ydata[1]), ... One can add a series by passing the two arrays using setDataSeries() or add the arrays individually using setXData() and setYData().

The different series have a label associated with them by default which can be disabled (see toggleSeriesLabel()).

The data is typically shown with axes that use a linear scale. However, the scale can be changed to logarithmic for each axis individually (see toggleLogarithmicX() and toggleLogarithmic()).

The LineChart can have a title (see getTitle() and setTitle()) and a subtitle (see setSubTitle() and getSubTitle()).

See also
See tutorial on using LineChart at: https://bridgesuncc.github.io/tutorials/LineChart.html
Author
Erik Saule
Date
08/11/21

Public Member Functions

 LineChart ()
 Line chart default constructor. More...
 
String getDataStructType ()
 gets the representation of the line chart as a JSON More...
 
void toggleMouseTrack (boolean val)
 Enables or disables mouse tracking. More...
 
void toggleSeriesLabel (boolean val)
 Enables or disables series labels. More...
 
void toggleLogarithmicX (boolean val)
 Change the X-axis scale to logarithmic. More...
 
void toggleLogarithmicY (boolean val)
 Change the Y-axis scale to logarithmic. 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 setYLabel (String yaxisName)
 Change the label for the Y-axis. More...
 
String getYLabel ()
 Returns the label for the Y-axis. More...
 
void setXLabel (String xaxisName)
 Change the label for the X-axis. More...
 
String getXLabel ()
 Returns the label for the Y-axis. More...
 
void setDataSeries (String seriesName, double[] xdata, double[] ydata)
 Add a series (or update it) More...
 
void setDataSeries (String seriesName, ArrayList< Double > xdata, ArrayList< Double > ydata)
 Add a series (or update it) More...
 
void setDataSeries (String seriesName, double[] xdata, ArrayList< Double > ydata)
 Add a series (or update it) More...
 
void setDataSeries (String seriesName, ArrayList< Double > xdata, double[] ydata)
 Add a series (or update it) More...
 
void setXData (String series, double[] xdata)
 Changes the X data for a series. More...
 
void setXData (String series, ArrayList< Double > xdata)
 Changes the X data for a series. More...
 
double[] getXData (String series)
 Returns the X data for a series. More...
 
void setYData (String series, ArrayList< Double > ydata)
 Changes the Y data for a series. More...
 
void setYData (String series, double[] ydata)
 Changes the Y data for a series. More...
 
double[] getYData (String series)
 Returns the Y data for a series. More...
 
String getDataStructureRepresentation ()
 

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 = "]"
 

Constructor & Destructor Documentation

◆ LineChart()

bridges.base.LineChart.LineChart ( )

Line chart default constructor.

Member Function Documentation

◆ getDataStructType()

String bridges.base.LineChart.getDataStructType ( )

gets the representation of the line chart as a JSON

Returns
JSON of line chart

Reimplemented from bridges.base.DataStruct.

◆ getDataStructureRepresentation()

String bridges.base.LineChart.getDataStructureRepresentation ( )

Reimplemented from bridges.base.DataStruct.

◆ getSubTitle()

String bridges.base.LineChart.getSubTitle ( )

Subtitle of the plot.

Returns
the subtitle to be shown

◆ getTitle()

String bridges.base.LineChart.getTitle ( )

Title of the plot.

Returns
the title to be shown

◆ getXData()

double [] bridges.base.LineChart.getXData ( String  series)

Returns the X data for a series.

Parameters
seriesindicate the series to get
Returns
the X data of series or null if the series is not in there

◆ getXLabel()

String bridges.base.LineChart.getXLabel ( )

Returns the label for the Y-axis.

Returns
label shown for the Y-axis

◆ getYData()

double [] bridges.base.LineChart.getYData ( String  series)

Returns the Y data for a series.

Parameters
seriesindicate the series to get
Returns
the Y data of series or null if the data is not in there

◆ getYLabel()

String bridges.base.LineChart.getYLabel ( )

Returns the label for the Y-axis.

Returns
label shown for the Y-axis

◆ setDataSeries() [1/4]

void bridges.base.LineChart.setDataSeries ( String  seriesName,
ArrayList< Double >  xdata,
ArrayList< Double >  ydata 
)

Add a series (or update it)

Parameters
seriesNameindicates the series to add (or change)
xdatathe X data in the series
ydatathe Y data in the series

◆ setDataSeries() [2/4]

void bridges.base.LineChart.setDataSeries ( String  seriesName,
ArrayList< Double >  xdata,
double[]  ydata 
)

Add a series (or update it)

Parameters
seriesNameindicates the series to add (or change)
xdatathe X data in the series
ydatathe Y data in the series

◆ setDataSeries() [3/4]

void bridges.base.LineChart.setDataSeries ( String  seriesName,
double[]  xdata,
ArrayList< Double >  ydata 
)

Add a series (or update it)

Parameters
seriesNameindicates the series to add (or change)
xdatathe X data in the series
ydatathe Y data in the series

◆ setDataSeries() [4/4]

void bridges.base.LineChart.setDataSeries ( String  seriesName,
double[]  xdata,
double[]  ydata 
)

Add a series (or update it)

Parameters
seriesNameindicates the series to add (or change)
xdatathe X data in the series
ydatathe Y data in the series

◆ setSubTitle()

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

Subtitle of the plot.

Parameters
sthe subtitle to be shown

◆ setTitle()

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

Title of the plot.

Parameters
tthe title to be shown

◆ setXData() [1/2]

void bridges.base.LineChart.setXData ( String  series,
ArrayList< Double >  xdata 
)

Changes the X data for a series.

Parameters
seriesindicates the series to get
xdatathe X data in the series

◆ setXData() [2/2]

void bridges.base.LineChart.setXData ( String  series,
double[]  xdata 
)

Changes the X data for a series.

Parameters
seriesindicates the series to get
xdatathe X data in the series

◆ setXLabel()

void bridges.base.LineChart.setXLabel ( String  xaxisName)

Change the label for the X-axis.

Parameters
xaxisNamelabel to use for the X-axis

◆ setYData() [1/2]

void bridges.base.LineChart.setYData ( String  series,
ArrayList< Double >  ydata 
)

Changes the Y data for a series.

Parameters
seriesindicates the series to get
ydatathe Y data in the series

◆ setYData() [2/2]

void bridges.base.LineChart.setYData ( String  series,
double[]  ydata 
)

Changes the Y data for a series.

Parameters
seriesindicates the series to get
ydatathe Y data in the series

◆ setYLabel()

void bridges.base.LineChart.setYLabel ( String  yaxisName)

Change the label for the Y-axis.

Parameters
yaxisNamelabel to show for the Y-axis

◆ toggleLogarithmicX()

void bridges.base.LineChart.toggleLogarithmicX ( boolean  val)

Change the X-axis scale to logarithmic.

When enabled, the X-axis scale becomes logarithmic (as opposed to linear).

Parameters
valShould the X-axis use a logarithmic scale?

◆ toggleLogarithmicY()

void bridges.base.LineChart.toggleLogarithmicY ( boolean  val)

Change the Y-axis scale to logarithmic.

When enabled, the Y-axis scale becomes logarithmic (as opposed to linear).

Parameters
valShould the Y-axis use a logarithmic scale?

◆ toggleMouseTrack()

void bridges.base.LineChart.toggleMouseTrack ( boolean  val)

Enables or disables mouse tracking.

Mouse tracking show the value of a data point when the mouse hovers on a data point.

Parameters
valShould mouse tracking be activated or not.

◆ toggleSeriesLabel()

void bridges.base.LineChart.toggleSeriesLabel ( boolean  val)

Enables or disables series labels.

When enabled, the name of the series will be shown on the line chart.

Parameters
valShould series be labeled or not

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