mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 13:17:00 -04:00
Some more graph tweaks
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@928 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -129,15 +129,19 @@ GraphData::GraphData(const GraphDataPre& d)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// find some nice colors for the groups
|
// find some nice colors for the groups
|
||||||
double hue = 0.6; // start hue
|
double step = 0;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
FOR_EACH(g, a->groups) {
|
FOR_EACH(g, a->groups) {
|
||||||
double amount = a->auto_color == AUTO_COLOR_EVEN
|
double amount = a->auto_color == AUTO_COLOR_EVEN
|
||||||
? 1. / a->groups.size()
|
? 1. / a->groups.size()
|
||||||
: double(g.size) / a->total; // amount this group takes
|
: double(g.size) / a->total; // amount this group takes
|
||||||
if (!first) hue += amount/2;
|
if (!first) step += amount/2;
|
||||||
g.color = hsl2rgb(hue, 1.0, 0.5);
|
if (a->numeric) {
|
||||||
hue += amount / 2;
|
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;
|
first = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -353,7 +357,7 @@ bool BarGraph2D::findItem(const RealPoint& pos, const RealRect& rect, vector<int
|
|||||||
// find row
|
// find row
|
||||||
int row = -1;
|
int row = -1;
|
||||||
size_t vs = col * axis2_data().groups.size();
|
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];
|
value -= values[vs+i];
|
||||||
if (value < 0) {
|
if (value < 0) {
|
||||||
// in this layer of the stack
|
// in this layer of the stack
|
||||||
|
|||||||
@@ -386,7 +386,8 @@ void StatsPanel::showCategory() {
|
|||||||
if (dimensionality(layout) != dims.size()) {
|
if (dimensionality(layout) != dims.size()) {
|
||||||
// we must switch to another layout
|
// we must switch to another layout
|
||||||
layout = dims.size() == 1 ? GRAPH_TYPE_BAR
|
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_TYPE_SCATTER_PIE;
|
||||||
}
|
}
|
||||||
graph->setLayout(layout, true);
|
graph->setLayout(layout, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user