Bridges-C++  3.4.2
Bridges(C++ API)
Public Member Functions | List of all members
bridges::datastructure::LineChart Class Reference

#include <LineChart.h>

Inheritance diagram for bridges::datastructure::LineChart:
bridges::datastructure::DataStructure

Detailed Description

Show 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 is 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()).

Author
Erik Saule, Kalpathi Subramanian
Date
7/16/19

Public Member Functions

 LineChart ()
 
virtual const string getDStype () const override
 Get the data type. More...
 
void toggleMouseTrack (bool val)
 Enables or disables mouse tracking. More...
 
void toggleSeriesLabel (bool val)
 Enables or disables series labels. More...
 
void toggleLogarithmicX (bool val)
 Change the X-axis scale to logarithmic. More...
 
void toggleLogarithmicY (bool val)
 Change the Y-axis scale to logarithmic. More...
 
void setTitle (string t)
 Title of the plot. More...
 
string getTitle () const
 Title of the plot. More...
 
void setSubTitle (string s)
 Subtitle of the plot. More...
 
string getSubTitle () const
 Subtitle of the plot. More...
 
void setYLabel (string yaxisName)
 Change the label for the Y-axis. More...
 
string getYLabel () const
 Returns the label for the Y-axis. More...
 
void setXLabel (string xaxisName)
 Change the label for the X-axis. More...
 
string getXLabel () const
 Returns the label for the Y-axis. More...
 
void setDataSeries (string seriesName, vector< double > xdata, vector< double > ydata)
 Add a series (or update it) More...
 
void setXData (string series, vector< double > xdata)
 Changes the X data for a series. More...
 
vector< double > getXData (string series)
 Returns the X data for a series. More...
 
void setYData (string series, vector< double > ydata)
 Changes the Y data for a series. More...
 
vector< double > getYData (string series)
 Returns the Y data for a series. More...
 
virtual const string getDataStructureRepresentation () const override
 
- Public Member Functions inherited from bridges::datastructure::DataStructure
virtual ~DataStructure ()=default
 

Constructor & Destructor Documentation

◆ LineChart()

bridges::datastructure::LineChart::LineChart ( )
inline

Member Function Documentation

◆ getDataStructureRepresentation()

virtual const string bridges::datastructure::LineChart::getDataStructureRepresentation ( ) const
inlineoverridevirtual

Ease of use function for the deletion of an entire datastructure. Overrides should call delete on itself and each linked data structure

Warning
Only call if all these data structures were all dynamicaly allocated(aka: using new) Gets the JSON representation of this DataStructure's nodes and links
Returns
The JSON representation of the data structure: A pair holding the nodes and links JSON strings respectively

Implements bridges::datastructure::DataStructure.

◆ getDStype()

virtual const string bridges::datastructure::LineChart::getDStype ( ) const
inlineoverridevirtual

Get the data type.

Returns
name of the data type (used internally)

Implements bridges::datastructure::DataStructure.

◆ getSubTitle()

string bridges::datastructure::LineChart::getSubTitle ( ) const
inline

Subtitle of the plot.

Returns
the subtitle to be shown

◆ getTitle()

string bridges::datastructure::LineChart::getTitle ( ) const
inline

Title of the plot.

Returns
the title to be shown

◆ getXData()

vector<double> bridges::datastructure::LineChart::getXData ( string  series)
inline

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::datastructure::LineChart::getXLabel ( ) const
inline

Returns the label for the Y-axis.

Returns
label shown for the Y-axis

◆ getYData()

vector<double> bridges::datastructure::LineChart::getYData ( string  series)
inline

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::datastructure::LineChart::getYLabel ( ) const
inline

Returns the label for the Y-axis.

Returns
label shown for the Y-axis

◆ setDataSeries()

void bridges::datastructure::LineChart::setDataSeries ( string  seriesName,
vector< double >  xdata,
vector< double >  ydata 
)
inline

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::datastructure::LineChart::setSubTitle ( string  s)
inline

Subtitle of the plot.

Parameters
sthe subtitle to be shown

◆ setTitle()

void bridges::datastructure::LineChart::setTitle ( string  t)
inline

Title of the plot.

Parameters
tthe title to be shown

◆ setXData()

void bridges::datastructure::LineChart::setXData ( string  series,
vector< double >  xdata 
)
inline

Changes the X data for a series.

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

◆ setXLabel()

void bridges::datastructure::LineChart::setXLabel ( string  xaxisName)
inline

Change the label for the X-axis.

Parameters
xaxisNamelabel to use for the X-axis

◆ setYData()

void bridges::datastructure::LineChart::setYData ( string  series,
vector< double >  ydata 
)
inline

Changes the Y data for a series.

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

◆ setYLabel()

void bridges::datastructure::LineChart::setYLabel ( string  yaxisName)
inline

Change the label for the Y-axis.

Parameters
yaxisNamelabel to show for the Y-axis

◆ toggleLogarithmicX()

void bridges::datastructure::LineChart::toggleLogarithmicX ( bool  val)
inline

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::datastructure::LineChart::toggleLogarithmicY ( bool  val)
inline

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::datastructure::LineChart::toggleMouseTrack ( bool  val)
inline

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::datastructure::LineChart::toggleSeriesLabel ( bool  val)
inline

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: