A box with the mean value in bar graphs.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@918 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-05-31 21:49:33 +00:00
parent 072d686044
commit 04bc58275b
2 changed files with 75 additions and 0 deletions
+18
View File
@@ -58,6 +58,7 @@ class GraphAxis : public IntrusivePtrBase<GraphAxis> {
, numeric(numeric)
, max(0)
, total(0)
, mean(0)
, colors(colors)
, order(order)
{}
@@ -68,6 +69,7 @@ class GraphAxis : public IntrusivePtrBase<GraphAxis> {
bool numeric; ///< Numeric axis?
UInt max; ///< Maximum size of the groups
UInt total; ///< Sum of the size of all groups
double mean; ///< Mean value, only for numeric axes
const map<String,Color>* colors; ///< Colors for each choice (optional)
const vector<String>* order; ///< Order of the items (optional)
};
@@ -231,6 +233,22 @@ class GraphLegend : public Graph1D {
bool reverse;
};
/// Simple statistics like the mean
class GraphStats : public Graph1D {
public:
inline GraphStats(size_t axis, Alignment alignment)
: Graph1D(axis), alignment(alignment)
{}
virtual RealSize determineSize(RotatedDC& dc) const;
virtual void draw(RotatedDC& dc, int current, DrawLayer layer) const;
virtual void setData(const GraphDataP& d);
private:
mutable RealSize size, item_size;
mutable double label_width;
Alignment alignment;
vector<pair<String,String> > values;
};
//class GraphTable {
//};