From 1bab5f609dcbda4e1c2c83a7029bbd5ffbd478c0 Mon Sep 17 00:00:00 2001 From: twanvl Date: Sun, 1 Jun 2008 00:31:57 +0000 Subject: [PATCH] Some more graph tweaks git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@928 0fc631ac-6414-0410-93d0-97cfa31319b6 --- src/gui/control/graph.cpp | 14 +++++++++----- src/gui/set/stats_panel.cpp | 3 ++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/gui/control/graph.cpp b/src/gui/control/graph.cpp index af492594..d96cd1f2 100644 --- a/src/gui/control/graph.cpp +++ b/src/gui/control/graph.cpp @@ -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, vectornumeric + ? GRAPH_TYPE_SCATTER : GRAPH_TYPE_STACK) : GRAPH_TYPE_SCATTER_PIE; } graph->setLayout(layout, true);