QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_box_statistics.h
1/******************************************************************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *
9 * Modified by ChenZongYan in 2024 <czy.t@163.com>
10 *****************************************************************************/
11
12#ifndef QWT_BOX_STATISTICS_H
13#define QWT_BOX_STATISTICS_H
14
15#include "qwtcore_global.h"
16#include "qwt_samples.h"
17
18#include <qvector.h>
19
26class QWTCORE_EXPORT QwtBoxStatisticsCalculator
27{
28public:
33 {
36
39
42
45
47 StandardError
48 };
49
52
54 void setWhiskerMethod(WhiskerMethod method);
55
57 WhiskerMethod whiskerMethod() const;
58
60 void setWhiskerCoefficient(double coeff);
61
63 double whiskerCoefficient() const;
64
66 static QwtBoxSample
67 calculate(double position, const QVector< double >& sortedData, WhiskerMethod method = Tukey, double coefficient = 1.5);
68
70 static QwtBoxSample calculateFromRaw(double position,
71 const QVector< double >& rawData,
72 WhiskerMethod method = Tukey,
73 double coefficient = 1.5);
74
76 static QVector< double > extractOutliers(const QwtBoxSample& sample, const QVector< double >& sortedData);
77
79 static void calculateFull(double position,
80 const QVector< double >& rawData,
81 QwtBoxSample& sample,
82 QwtBoxOutlierSample& outliers,
83 WhiskerMethod method = Tukey,
84 double coefficient = 1.5);
85
86private:
88 static double quantile(const QVector< double >& sorted, double p);
89
91 static double median(const QVector< double >& sorted);
92
94 static double iqr(const QVector< double >& sorted);
95
97 static double mean(const QVector< double >& data);
98
100 static double standardDeviation(const QVector< double >& data);
101
103 static QVector< double > sortData(const QVector< double >& data);
104
105 WhiskerMethod m_method;
106 double m_coefficient { 1.5 };
107};
108
109#endif // QWT_BOX_STATISTICS_H
Outlier values for a single boxplot position
Definition qwt_samples.h:452
Sample for box-and-whisker plot (boxplot) visualization
Definition qwt_samples.h:363
Helper class for computing boxplot statistics from raw data
Definition qwt_box_statistics.h:27
WhiskerMethod
Whisker calculation method
Definition qwt_box_statistics.h:33
@ MinMax
Min/Max method: whiskers at actual data min/max
Definition qwt_box_statistics.h:41
@ StandardDeviation
Standard deviation method: whiskers at mean ± coeff×SD
Definition qwt_box_statistics.h:44
@ Percentile
Percentile method: whiskers at specified percentile range
Definition qwt_box_statistics.h:38
@ Tukey
Tukey's method: whiskers extend to 1.5×IQR from Q1/Q3 (default)
Definition qwt_box_statistics.h:35