![]() |
Bridges-C++ 3.5.0
Bridges(C++ API)
|
Support for drawing Bar charts. More...
#include <BarChart.h>
Public Member Functions | |
BarChart () | |
makes an empty BarChart More... | |
virtual const string | getDStype () const override |
Get the data type. More... | |
void | setTitle (std::string t) |
Set title of the plot. More... | |
std::string | getTitle () const |
Get title of the plot. More... | |
void | setSubTitle (const std::string &s) |
set subtitle of the plot More... | |
std::string | getSubTitle () const |
get the subtitle of the plot More... | |
void | setValueLabel (const std::string &vAxisName) |
Set the label for the value axis. More... | |
std::string | getValueLabel () const |
Returns the label for the value axis. More... | |
void | setCategoriesLabel (const std::string &cAxisName) |
Change the label for category axis. More... | |
std::string | getCategoriesLabel () const |
Returns the axis label for the categories. More... | |
void | setBarOrientation (const std::string &orient) |
sets the bar chart orientation More... | |
std::string | getBarOrientation () const |
gets the bar chart orientation More... | |
void | setTooltipSuffix (const std::string &suffix) |
sets the tooltip suffix More... | |
std::string | getTooltipSuffix () const |
gets the tooltip suffix More... | |
void | setCategories (const std::vector< std::string > &categories) |
set the categories for this bar chart More... | |
void | addDataSeries (std::string seriesName, std::vector< double > data) |
Add a series of data. More... | |
virtual const std::string | getDataStructureRepresentation () const override |
get the data structure representation as a JSON More... | |
![]() | |
virtual | ~DataStructure ()=default |
virtual const string | getDStype () const =0 |
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.
|
inline |
makes an empty BarChart
|
inline |
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.
seriesName | indicates the name of the data to add |
data | values of that serie for each category |
|
inline |
gets the bar chart orientation
|
inline |
Returns the axis label for the categories.
|
inlineoverridevirtual |
get the data structure representation as a JSON
This is an internal function to BRIDGES. There are little reasons to call this function directly.
Implements bridges::datastructure::DataStructure.
|
inlineoverridevirtual |
Get the data type.
This is an internal function to BRIDGES. There are little reasons to call this function directly.
Implements bridges::datastructure::DataStructure.
|
inline |
get the subtitle of the plot
|
inline |
Get title of the plot.
|
inline |
gets the tooltip suffix
|
inline |
Returns the label for the value axis.
|
inline |
sets the bar chart orientation
orient | can be 'horizontal' or 'vertical'. (Throws exception on other values) |
|
inline |
set the categories for this bar chart
Will throw an exception if there are already data series defined.
categories | Names of different categories |
|
inline |
Change the label for category axis.
cAxisName | label for the category axis |
|
inline |
set subtitle of the plot
s | the subtitle of the BarChart |
|
inline |
Set title of the plot.
t | the title of the BarChart |
|
inline |
sets the tooltip suffix
This appends a string to the values in the hover tooltip.
suffix |
|
inline |
Set the label for the value axis.
vAxisName | label for the value axis |