Author: croberts
Date: 2012-12-14 15:47:00 +0000 (Fri, 14 Dec 2012)
New Revision: 5596
Modified:
trunk/cumin/python/cumin/grid/dashboard.py
trunk/cumin/python/cumin/stat.py
trunk/cumin/resources/app.js
Log:
Per BZ883784, swapping the free/used stats on the plumage charts for memory/cpu so that
used is on the bottom, free is on the top....same colors.
Modified: trunk/cumin/python/cumin/grid/dashboard.py
===================================================================
--- trunk/cumin/python/cumin/grid/dashboard.py 2012-12-14 15:19:48 UTC (rev 5595)
+++ trunk/cumin/python/cumin/grid/dashboard.py 2012-12-14 15:47:00 UTC (rev 5596)
@@ -56,14 +56,16 @@
charts.add_child(chart)
chart = self.PoolMemoryChart(app, "fmem",
app.model.com_redhat_grid_plumage.OSUtil)
- chart.stats = ["usedmem", "freemem"]
+ chart.stats = ["freemem", "usedmem"]
+ chart.colors = ["#992600", "#009926"]
chart.max_samples = 250
chart.duration.param.default = "86400"
chart.chart_type = "stacked"
charts.add_child(chart)
chart = self.PoolCpuChart(app, "fcpu",
app.model.com_redhat_grid_plumage.OSUtil)
- chart.stats = [ "usedcpu", "freecpu"]
+ chart.stats = [ "freecpu", "usedcpu"]
+ chart.colors = ["#992600", "#009926"]
chart.max_samples = 250
chart.duration.param.default = "86400"
chart.chart_type = "stacked"
Modified: trunk/cumin/python/cumin/stat.py
===================================================================
--- trunk/cumin/python/cumin/stat.py 2012-12-14 15:19:48 UTC (rev 5595)
+++ trunk/cumin/python/cumin/stat.py 2012-12-14 15:47:00 UTC (rev 5596)
@@ -2,6 +2,7 @@
import logging
from datetime import datetime, timedelta
from time import time, sleep
+from urllib import pathname2url
from wooly import Widget, Page, Parameter, Attribute
from wooly.util import StringCatalog, escape_entity, Writer
@@ -144,6 +145,7 @@
self.stats = ()
self.chart_type = None
self.title = None
+ self.colors = None
self.stats_tmpl = WidgetTemplate(self, "stat_html")
@@ -178,6 +180,10 @@
if self.chart_type:
params.append("type=%s" % self.chart_type)
+ if self.colors:
+ for color in self.colors:
+ params.append("color=%s" % pathname2url(color))
+
return params
def render_href(self, session):
@@ -230,6 +236,10 @@
if self.mode:
params.append("mode=%s" % self.mode)
+ if self.colors:
+ for color in self.colors:
+ params.append("color=%s" % pathname2url(color))
+
params.append("maxsamp=%s" % self.max_samples)
return params
@@ -489,6 +499,10 @@
self.maxsamp = IntegerParameter(app, "maxsamp")
self.maxsamp.default = 0
self.add_parameter(self.maxsamp)
+
+ param = Parameter(app, "cparam")
+ self.colors = ListParameter(app, "color", param)
+ self.add_parameter(self.colors)
self.cache = ImageCache()
@@ -794,7 +808,7 @@
return chart.create()
class FlashLineChart(Widget):
- colors = ('#FF0000', '#0000FF', '#00FF00', '#FF00FF',
'#FFFF00', '#00FFFF', '#000000')
+ colors =
('#009926','#992600','#0036d6','#ffc414','730099','#ff00cc')
one_day = 24 * 60 * 60
def __init__(self, app, name, page):
super(FlashLineChart, self).__init__(app, name)
@@ -879,6 +893,8 @@
height = self.page.container_height.get(session)
mode = self.page.mode.get(session)
method = self.page.method.get(session)
+ if len(self.page.colors.get(session)) > 0:
+ self.colors = self.page.colors.get(session)
time_span = self.get_time_span(session)
duration = self.get_duration(session)
@@ -921,6 +937,7 @@
# create the chart dict
chart = self.get_chart(session, adapter, stats, samples, time_span, max_value,
min_value, append, end_seconds_ago)
#print "**********\n"+chart.create()
+ chart.colors = self.colors
chart.graph_div = "%s_chart" % chart.id.replace(".",
"_")
# doing this the ugly way for python 2.4
if self.stackSeries == True:
Modified: trunk/cumin/resources/app.js
===================================================================
--- trunk/cumin/resources/app.js 2012-12-14 15:19:48 UTC (rev 5595)
+++ trunk/cumin/resources/app.js 2012-12-14 15:47:00 UTC (rev 5596)
@@ -588,6 +588,7 @@
.append([ json.x_axis.labels.labels[i].text ]);
}
dataContainer['stackSeries'] = json.stackSeries == 1 ? true:false;
+ dataContainer['colors'] = json.colors;
return dataContainer;
}
@@ -651,7 +652,7 @@
},
series: getSeries(dataContainer),
stackSeries: dataContainer['stackSeries'],
- seriesColors:
['#009926','#992600','#0036d6','#ffc414','730099','#ff00cc'],
+ seriesColors: dataContainer['colors'],
seriesDefaults: {
lineWidth:1,
fill:true,