mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
statistics: replace QtCharts' axes
Replace by custom implementation, with the ultimate goal to remove the QtCharts module. This doesn't yet display axis titles or a grid. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
598058e21e
commit
4ab9f1c6b0
15 changed files with 377 additions and 225 deletions
|
|
@ -41,7 +41,7 @@ private slots:
|
|||
void replotIfVisible();
|
||||
private:
|
||||
void reset(); // clears all series and axes
|
||||
void addAxes(StatsAxis *x, StatsAxis *y); // Add new x- and y-axis
|
||||
void setAxes(StatsAxis *x, StatsAxis *y);
|
||||
void plotBarChart(const std::vector<dive *> &dives,
|
||||
ChartSubType subType,
|
||||
const StatsVariable *categoryVariable, const StatsBinner *categoryBinner,
|
||||
|
|
@ -99,23 +99,23 @@ private:
|
|||
// A short line used to mark quartiles
|
||||
struct QuartileMarker {
|
||||
std::unique_ptr<QGraphicsLineItem> item;
|
||||
QtCharts::QAbstractSeries *series; // In case we ever support charts with multiple axes
|
||||
StatsAxis *xAxis, *yAxis;
|
||||
double pos, value;
|
||||
QuartileMarker(double pos, double value, QtCharts::QAbstractSeries *series);
|
||||
QuartileMarker(double pos, double value, QtCharts::QChart *chart, StatsAxis *xAxis, StatsAxis *yAxis);
|
||||
void updatePosition();
|
||||
};
|
||||
|
||||
// A general line marker
|
||||
struct LineMarker {
|
||||
std::unique_ptr<QGraphicsLineItem> item;
|
||||
QtCharts::QAbstractSeries *series; // In case we ever support charts with multiple axes
|
||||
StatsAxis *xAxis, *yAxis;
|
||||
QPointF from, to; // In local coordinates
|
||||
void updatePosition();
|
||||
LineMarker(QPointF from, QPointF to, QPen pen, QtCharts::QAbstractSeries *series);
|
||||
LineMarker(QPointF from, QPointF to, QPen pen, QtCharts::QChart *chart, StatsAxis *xAxis, StatsAxis *yAxis);
|
||||
};
|
||||
|
||||
void addLinearRegression(double a, double b, double minX, double maxX, double minY, double maxY, QtCharts::QAbstractSeries *series);
|
||||
void addHistogramMarker(double pos, double low, double high, const QPen &pen, bool isHorizontal, QtCharts::QAbstractSeries *series);
|
||||
void addLinearRegression(double a, double b, double minX, double maxX, double minY, double maxY, StatsAxis *xAxis, StatsAxis *yAxis);
|
||||
void addHistogramMarker(double pos, double low, double high, const QPen &pen, bool isHorizontal, StatsAxis *xAxis, StatsAxis *yAxis);
|
||||
|
||||
StatsState state;
|
||||
QtCharts::QChart *chart;
|
||||
|
|
@ -127,6 +127,7 @@ private:
|
|||
std::vector<LineMarker> lineMarkers;
|
||||
std::unique_ptr<QGraphicsSimpleTextItem> title;
|
||||
StatsSeries *highlightedSeries;
|
||||
StatsAxis *xAxis, *yAxis;
|
||||
|
||||
// This is unfortunate: we can't derive from QChart, because the chart is allocated by QML.
|
||||
// Therefore, we have to listen to hover events using an events-filter.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue