Skip to main content

Bar Chart

Preview:

Preview

It's a bar chart. period.

You can aggregate large amount of data in form of arrays and display them in a bar chart.


Type:

BAR_CHART


Valid Data Types for X-Axis:

  • int
  • float
  • String

Valid Data Types for Y-Axis:

  • int
  • float

Initializer:

/* 
Bar Chart
Valid Arguments: (ESPDash dashboard, Card Type, const char* name )
*/
Chart chart1(&dashboard, BAR_CHART, "Chart Name");

Updaters:

For X-Axis:

X-Axis updater uses updateX function.

/*
Data for X Axis of our Chart
This array can be of: `int` / `float` or `String`
*/
String XAxis[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};

/*
Update Function for Chart is as follows:
--------
(int array[], size_t array_size)
or
(float array[], size_t array_size)
or
(String array[], size_t array_size)
*/
chart1.updateX(XAxis, 7);
For Y-Axis:

Y-Axis updater uses updateY function.

/*
Data for Y Axis of our Chart
This array can be of: `int` or `float`
*/
int YAxis[] = {0, 0, 0, 0, 0, 0, 0};

/*
Update Function for Chart is as follows:
--------
(int array[], size_t array_size)
or
(float array[], size_t array_size)
*/
chart1.updateY(YAxis, 7);