Show first bars of data

This commit is contained in:
Sem van der Hoeven
2025-04-03 00:22:07 +02:00
parent 2f325e3254
commit 48933e2bab
6 changed files with 218 additions and 92 deletions

View File

@@ -11,6 +11,17 @@ void bar_draw_horizontal(int start_x, int start_y, int width, int height, int va
display->fillRect(start_x, start_y, start_x + bar_width, start_y + height);
}
void bar_draw_horizontal(int start_x, int start_y, int width, int height, int value, int max_value, byte r, byte g, byte b, char fill_outline, UTFT *display)
{
display->setColor(r,g,b);
int bar_width = (int)((float)value / (float)max_value * width);
if (fill_outline)
{
display->drawRect(start_x, start_y, start_x + width, start_y + height);
}
display->fillRect(start_x, start_y, start_x + bar_width, start_y + height);
}
void bar_draw_vertical(int start_x, int start_y, int width, int height, int value, int max_value, uint color, char fill_outline, UTFT *display)
{
display->setColor(color);
@@ -22,6 +33,17 @@ void bar_draw_vertical(int start_x, int start_y, int width, int height, int valu
display->fillRect(start_x, (start_y + height) - bar_height, start_x + width, start_y + height);
}
void bar_draw_vertical(int start_x, int start_y, int width, int height, int value, int max_value, byte r, byte g, byte b, char fill_outline, UTFT *display)
{
display->setColor(r,g,b);
int bar_height = (int)((float)value / (float)max_value * height);
if (fill_outline)
{
display->drawRect(start_x, start_y, start_x + width, start_y + height);
}
display->fillRect(start_x, (start_y + height) - bar_height, start_x + width, start_y + height);
}
void bar_clear_part_horizontal(int start_x, int start_y, int width, int height, int value_from, int max_value, char clear_color, char clear_outline, UTFT *display)
{
display->setColor(clear_color);