40 POSITION_LEFT_TOP = 0,
41 POSITION_RIGHT_TOP = 1,
42 POSITION_LEFT_BOTTOM = 2,
43 POSITION_RIGHT_BOTTOM = 3,
62 TEXT_CURRENT = 1 << 0,
66 TEXT_ALL = TEXT_CURRENT | TEXT_AVG | TEXT_MAX | TEXT_MIN,
76 struct graph_interpolated_values_range {
77 double shrink_weight_max, shrink_weight_min;
78 double upd_timer_max, upd_timer_min, max_timer_delay;
82 void update(
const double &_min,
const double &_max,
const double &_avg,
const double &_delta);
83 void reset(uint32_t _buffer_size,
double _upd_timer_delay = 2.0);
90 bool upside_down =
true;
92 bool show_title =
false;
95 GraphLinePosition line_position = GraphLinePosition::LINE_CENTER;
98 BitField<TextFlags> show_text_flags = TextFlags::TEXT_ALL;
100 Vector2i size = Vector2i(256, 64);
102 int buffer_size = 256;
104 Vector2i offset = Vector2i(8, 8);
106 GraphPosition corner = GraphPosition::POSITION_RIGHT_TOP;
108 real_t line_width = 1.0f;
110 Color line_color = Colors::orange_red;
112 Color background_color = Colors::gray_graph_bg;
114 Color border_color = Colors::black;
117 String text_suffix =
"";
119 Ref<Font> custom_font = Ref<Font>();
125 Color title_color = Colors::white_smoke;
127 Color text_color = Colors::white_smoke;
129 int text_precision = 2;
131 StringName parent_graph;
133 GraphSide parent_graph_side = GraphSide::SIDE_BOTTOM;
135 Callable data_getter;
138 mutable graph_interpolated_values_range graph_range = {};
143 DataGraphManager *owner =
nullptr;
145 mutable ProfiledMutex(std::recursive_mutex, datalock,
"Graphs draw lock");
147 std::unique_ptr<CircularBuffer<double> > buffer_data;
150 static void _bind_methods();
153 virtual void _update_received(
double _value);
155 void _init(DataGraphManager *_owner, StringName _title);
164 virtual GraphType get_type() {
return GraphType::GRAPH_NORMAL; };
175 bool is_enabled()
const;
180 bool is_upside_down()
const;
185 bool is_show_title()
const;
192 BitField<TextFlags> get_show_text_flags()
const;
197 Vector2i get_size()
const;
202 int get_buffer_size()
const;
207 Vector2i get_offset()
const;
218 real_t get_line_width()
const;
223 Color get_line_color()
const;
228 Color get_background_color()
const;
233 Color get_border_color()
const;
238 String get_text_suffix()
const;
243 Ref<Font> get_custom_font()
const;
248 int get_title_size()
const;
253 int get_text_size()
const;
258 Color get_title_color()
const;
263 Color get_text_color()
const;
268 int get_text_precision()
const;
273 StringName get_parent_graph()
const;
284 Callable get_data_getter()
const;
293 void update(
double value);
304 graph_rects draw(CanvasItem *_ci,
const Ref<Font> &_font,
const graph_rects &_prev_rects,
const GraphPosition &_corner,
const bool &_is_root,
const double &_delta)
const;
366 void draw(CanvasItem *_ci, Ref<Font> _font, Vector2 _vp_size,
double _delta)
const;