Commit 749d8ac6 authored by twanvl's avatar twanvl

Some more graph tweaks

parent ae5230ee
......@@ -129,15 +129,19 @@ GraphData::GraphData(const GraphDataPre& d)
}
} else {
// find some nice colors for the groups
double hue = 0.6; // start hue
double step = 0;
bool first = true;
FOR_EACH(g, a->groups) {
double amount = a->auto_color == AUTO_COLOR_EVEN
? 1. / a->groups.size()
: double(g.size) / a->total; // amount this group takes
if (!first) hue += amount/2;
g.color = hsl2rgb(hue, 1.0, 0.5);
hue += amount / 2;
if (!first) step += amount/2;
if (a->numeric) {
g.color = hsl2rgb(0.65 - 0.82 * step, 0.9 - 0.2 * fabs(step - 0.5), 0.3 + 0.35 * step);
} else {
g.color = hsl2rgb(0.6 + step, 0.9, 0.5);
}
step += amount / 2;
first = false;
}
}
......@@ -353,7 +357,7 @@ bool BarGraph2D::findItem(const RealPoint& pos, const RealRect& rect, vector<int
// find row
int row = -1;
size_t vs = col * axis2_data().groups.size();
for (int i = 0 ; i < count ; ++i) {
for (int i = 0 ; i < (int)values.size() ; ++i) {
value -= values[vs+i];
if (value < 0) {
// in this layer of the stack
......
......@@ -386,7 +386,8 @@ void StatsPanel::showCategory() {
if (dimensionality(layout) != dims.size()) {
// we must switch to another layout
layout = dims.size() == 1 ? GRAPH_TYPE_BAR
: dims.size() == 2 ? GRAPH_TYPE_STACK
: dims.size() == 2 ? (layout == GRAPH_TYPE_SCATTER_PIE || dims[1]->numeric
? GRAPH_TYPE_SCATTER : GRAPH_TYPE_STACK)
: GRAPH_TYPE_SCATTER_PIE;
}
graph->setLayout(layout, true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment