forked from IQ.Lvbs/IQ.Pilot
IQ.Pilot Release Commit @ 0b96bd5
This commit is contained in:
34
iqpilot/tools/cabana/ui/chart/sparkline.h
Normal file
34
iqpilot/tools/cabana/ui/chart/sparkline.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "imgui.h"
|
||||
#include "tools/cabana/dbc/dbc.h"
|
||||
#include "tools/cabana/streams/abstractstream.h"
|
||||
|
||||
class Sparkline {
|
||||
public:
|
||||
void update(const cabana::Signal *sig, CanEventIter first, CanEventIter last, int range, ImVec2 sz, double window_end);
|
||||
inline double freq() const { return freq_; }
|
||||
bool isEmpty() const { return render_points_.empty(); }
|
||||
|
||||
void draw(ImDrawList *draw_list, ImVec2 pos) const;
|
||||
|
||||
ImVec2 size = {};
|
||||
double min_val = 0;
|
||||
double max_val = 0;
|
||||
|
||||
private:
|
||||
struct Point {
|
||||
double x, y;
|
||||
};
|
||||
void render(const CabanaColor &color, int range, ImVec2 sz, double window_end);
|
||||
|
||||
std::vector<Point> points_;
|
||||
std::vector<ImVec2> render_points_;
|
||||
ImU32 color_ = 0;
|
||||
double window_end_ = 0;
|
||||
double xscale_ = 0;
|
||||
bool draw_individual_points_ = false;
|
||||
double freq_ = 0;
|
||||
};
|
||||
Reference in New Issue
Block a user