1
0
mirror of https://github.com/esphome/esphome.git synced 2025-02-19 03:18:14 +00:00

[graph] Remove `stream` dependency (#8243)

This commit is contained in:
Keith Burzinski 2025-02-12 21:37:29 -06:00 committed by Jesse Hills
parent 35d303809e
commit e9a537784e
No known key found for this signature in database
GPG Key ID: BEAAE804EFD8E83A

View File

@ -4,9 +4,6 @@
#include "esphome/core/log.h"
#include "esphome/core/hal.h"
#include <algorithm>
#include <sstream>
#include <iostream> // std::cout, std::fixed
#include <iomanip>
namespace esphome {
namespace graph {
@ -231,9 +228,8 @@ void GraphLegend::init(Graph *g) {
ESP_LOGI(TAGL, " %s %d %d", txtstr.c_str(), fw, fh);
if (this->values_ != VALUE_POSITION_TYPE_NONE) {
std::stringstream ss;
ss << std::fixed << std::setprecision(trace->sensor_->get_accuracy_decimals()) << trace->sensor_->get_state();
std::string valstr = ss.str();
std::string valstr =
value_accuracy_to_string(trace->sensor_->get_state(), trace->sensor_->get_accuracy_decimals());
if (this->units_) {
valstr += trace->sensor_->get_unit_of_measurement();
}
@ -368,9 +364,8 @@ void Graph::draw_legend(display::Display *buff, uint16_t x_offset, uint16_t y_of
if (legend_->values_ != VALUE_POSITION_TYPE_NONE) {
int xv = x + legend_->xv_;
int yv = y + legend_->yv_;
std::stringstream ss;
ss << std::fixed << std::setprecision(trace->sensor_->get_accuracy_decimals()) << trace->sensor_->get_state();
std::string valstr = ss.str();
std::string valstr =
value_accuracy_to_string(trace->sensor_->get_state(), trace->sensor_->get_accuracy_decimals());
if (legend_->units_) {
valstr += trace->sensor_->get_unit_of_measurement();
}