mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	Added getters for graphs ymin and ymax (#8112)
Co-authored-by: guillempages <guillempages@users.noreply.github.com>
This commit is contained in:
		| @@ -132,6 +132,10 @@ void Graph::draw(Display *buff, uint16_t x_offset, uint16_t y_offset, Color colo | |||||||
|     yrange = ymax - ymin; |     yrange = ymax - ymin; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   // Store graph limts | ||||||
|  |   this->graph_limit_max_ = ymax; | ||||||
|  |   this->graph_limit_min_ = ymin; | ||||||
|  |  | ||||||
|   /// Draw grid |   /// Draw grid | ||||||
|   if (!std::isnan(this->gridspacing_y_)) { |   if (!std::isnan(this->gridspacing_y_)) { | ||||||
|     for (int y = yn; y <= ym; y++) { |     for (int y = yn; y <= ym; y++) { | ||||||
|   | |||||||
| @@ -161,11 +161,15 @@ class Graph : public Component { | |||||||
|   uint32_t get_duration() { return duration_; } |   uint32_t get_duration() { return duration_; } | ||||||
|   uint32_t get_width() { return width_; } |   uint32_t get_width() { return width_; } | ||||||
|   uint32_t get_height() { return height_; } |   uint32_t get_height() { return height_; } | ||||||
|  |   float get_graph_limit_min() { return graph_limit_min_; } | ||||||
|  |   float get_graph_limit_max() { return graph_limit_max_; } | ||||||
|  |  | ||||||
|  protected: |  protected: | ||||||
|   uint32_t duration_;  /// in seconds |   uint32_t duration_;  /// in seconds | ||||||
|   uint32_t width_;     /// in pixels |   uint32_t width_;     /// in pixels | ||||||
|   uint32_t height_;    /// in pixels |   uint32_t height_;    /// in pixels | ||||||
|  |   float graph_limit_min_{NAN}; | ||||||
|  |   float graph_limit_max_{NAN}; | ||||||
|   float min_value_{NAN}; |   float min_value_{NAN}; | ||||||
|   float max_value_{NAN}; |   float max_value_{NAN}; | ||||||
|   float min_range_{1.0}; |   float min_range_{1.0}; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user