mirror of
https://github.com/esphome/esphome.git
synced 2025-02-20 20:08:20 +00:00
[graph] Remove `stream
` dependency (#8243)
This commit is contained in:
parent
35d303809e
commit
e9a537784e
@ -4,9 +4,6 @@
|
|||||||
#include "esphome/core/log.h"
|
#include "esphome/core/log.h"
|
||||||
#include "esphome/core/hal.h"
|
#include "esphome/core/hal.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <sstream>
|
|
||||||
#include <iostream> // std::cout, std::fixed
|
|
||||||
#include <iomanip>
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace graph {
|
namespace graph {
|
||||||
|
|
||||||
@ -231,9 +228,8 @@ void GraphLegend::init(Graph *g) {
|
|||||||
ESP_LOGI(TAGL, " %s %d %d", txtstr.c_str(), fw, fh);
|
ESP_LOGI(TAGL, " %s %d %d", txtstr.c_str(), fw, fh);
|
||||||
|
|
||||||
if (this->values_ != VALUE_POSITION_TYPE_NONE) {
|
if (this->values_ != VALUE_POSITION_TYPE_NONE) {
|
||||||
std::stringstream ss;
|
std::string valstr =
|
||||||
ss << std::fixed << std::setprecision(trace->sensor_->get_accuracy_decimals()) << trace->sensor_->get_state();
|
value_accuracy_to_string(trace->sensor_->get_state(), trace->sensor_->get_accuracy_decimals());
|
||||||
std::string valstr = ss.str();
|
|
||||||
if (this->units_) {
|
if (this->units_) {
|
||||||
valstr += trace->sensor_->get_unit_of_measurement();
|
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) {
|
if (legend_->values_ != VALUE_POSITION_TYPE_NONE) {
|
||||||
int xv = x + legend_->xv_;
|
int xv = x + legend_->xv_;
|
||||||
int yv = y + legend_->yv_;
|
int yv = y + legend_->yv_;
|
||||||
std::stringstream ss;
|
std::string valstr =
|
||||||
ss << std::fixed << std::setprecision(trace->sensor_->get_accuracy_decimals()) << trace->sensor_->get_state();
|
value_accuracy_to_string(trace->sensor_->get_state(), trace->sensor_->get_accuracy_decimals());
|
||||||
std::string valstr = ss.str();
|
|
||||||
if (legend_->units_) {
|
if (legend_->units_) {
|
||||||
valstr += trace->sensor_->get_unit_of_measurement();
|
valstr += trace->sensor_->get_unit_of_measurement();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user