parent
983ac6c235
commit
a46544f708
3 changed files with 28 additions and 61 deletions
@ -1,29 +1,24 @@ |
|||||||
#pragma once |
#pragma once |
||||||
|
|
||||||
#include <algorithm> |
|
||||||
|
|
||||||
#include <QPixmap> |
#include <QPixmap> |
||||||
#include <QPointF> |
#include <QPointF> |
||||||
#include <vector> |
#include <vector> |
||||||
|
|
||||||
#include "tools/cabana/dbc/dbcmanager.h" |
#include "tools/cabana/dbc/dbc.h" |
||||||
|
|
||||||
class Sparkline { |
class Sparkline { |
||||||
public: |
public: |
||||||
void update(const MessageId &msg_id, const cabana::Signal *sig, double last_msg_ts, int range, QSize size); |
void update(const MessageId &msg_id, const cabana::Signal *sig, double last_msg_ts, int range, QSize size); |
||||||
const QSize size() const { return pixmap.size() / pixmap.devicePixelRatio(); } |
inline double freq() const { return freq_; } |
||||||
inline double freq() const { |
bool isEmpty() const { return pixmap.isNull(); } |
||||||
return values.empty() ? 0 : values.size() / std::max(values.back().x() - values.front().x(), 1.0); |
|
||||||
} |
|
||||||
|
|
||||||
QPixmap pixmap; |
QPixmap pixmap; |
||||||
double min_val = 0; |
double min_val = 0; |
||||||
double max_val = 0; |
double max_val = 0; |
||||||
double last_ts = 0; |
|
||||||
int time_range = 0; |
|
||||||
|
|
||||||
private: |
private: |
||||||
void render(const QColor &color, QSize size); |
void render(const QColor &color, int range, QSize size); |
||||||
std::vector<QPointF> values; |
|
||||||
std::vector<QPointF> points; |
std::vector<QPointF> points; |
||||||
|
double freq_ = 0; |
||||||
}; |
}; |
||||||
|
Loading…
Reference in new issue