Commit 673ccbc6 authored by metzlerd's avatar metzlerd
Browse files

Implemented controlled color

parent 70752dd0
......@@ -63,6 +63,12 @@ class FrxChart extends FrxRenderer {
if ($link) {
$links = $this->xmlToValues($path, $link, $label);
}
// Deal with rare case where attributes are supposed to come from data
if (@$attributes['color'] && !is_array($attributes['color']) && strpos($attributes['color'], '{') !==FALSE) {
$options['colors'] = $this->xmlToValues($path, $attributes['color']);
}
if ($data) {
if (method_exists($this, 'renderChart')) {
......
......@@ -26,6 +26,7 @@
<svg id="state-chart" frx:block="sampledb/users_by_state"
frx:renderer="FrxSVGGraph" frx:type="bargraph"
frx:xpath="*[total&gt;10000]"
frx:color="{color}"
frx:link="sample.user_distribution_simple?state={state}"
frx:series_1="{total}" frx:label="{state}">
</svg>
......
......@@ -28,6 +28,7 @@
<svg id="state-chart" frx:block="sampledb/users_by_state"
frx:renderer="FrxSVGGraph" frx:type="bargraph"
frx:xpath="*[total&gt;10000]"
frx:color="{color}"
frx:link="sample.user_distribution_simple?state={state}"
frx:series_1="{total}" frx:label="{state}">
</svg>
......
......@@ -4,10 +4,15 @@ select
name,
total,
CASE
WHEN total>10000 THEN 'good'
WHEN total>20000 THEN 'good'
WHEN total>5000 THEN 'average'
ELSE 'poor'
end AS classification
end AS classification,
CASE
WHEN total>20000 then 'green'
WHEN total>5000 THEN 'yellow'
ELSE 'red'
END as color
FROM states s join
(SELECT state,sum(users) as total from user_distribution
GROUP BY state) su
......
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