Skip to Content
You're viewing documentation of an outdated version. Check the latest documentation for v5.x.x
ChartsLine

Line Chart

This feature is only available in ESP-DASH Pro
Preview

Initializer

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

Updater

Use the following functions to update the chart:

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` Note: this array should be kept in global scope. i.e. it should never be deleted from memory. */ 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) or (const char* array[], size_t array_size) */ chart1.updateX(XAxis, 7);

X-Axis Data Types

  • int
  • float
  • String
  • const char*

For Y-Axis

Y-Axis updater uses updateY function.

/* Data for Y Axis of our Chart This array can be of: `int` or `float` Note: this array should be kept in global scope. i.e. it should never be deleted from memory. */ 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);

Y-Axis Data Types

  • int
  • float

Reference

This is a reference sketch showing positions for intializer and updater.

... /* Line Chart initializer */ Chart line(&dashboard, LINE_CHART, "Chart Name"); /* XAxis & YAxis data in global scope */ int YAxis[] = {0, 0, 0, 0, 0, 0, 0}; String XAxis[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; void setup() { ... /* Line chart x-axis updater - can be used anywhere (apart from global scope) */ line.updateX(XAxis, 7); // Ideally only once in setup block /* Line chart y-axis updater - can be used anywhere (apart from global scope) */ line.updateY(YAxis, 7); } void loop() { ... }
Last updated on
Copyright © 2025 Softt. All rights reserved.