← Back to team overview

graphite-dev team mailing list archive

[Merge] lp:~katzj/graphite/color into lp:graphite

 

Jeremy Katz has proposed merging lp:~katzj/graphite/color into lp:graphite.

Requested reviews:
  graphite-dev (graphite-dev)

For more details, see:
https://code.launchpad.net/~katzj/graphite/color/+merge/56427

Adds a simple color() function.  Also fixes up an obvious error that was keeping head from working
-- 
https://code.launchpad.net/~katzj/graphite/color/+merge/56427
Your team graphite-dev is requested to review the proposed merge of lp:~katzj/graphite/color into lp:graphite.
=== modified file 'webapp/content/js/composer_widgets.js'
--- webapp/content/js/composer_widgets.js	2011-04-02 21:07:25 +0000
+++ webapp/content/js/composer_widgets.js	2011-04-05 18:35:45 +0000
@@ -536,6 +536,7 @@
                 text: 'Special',
                 menu: [
                   {text: 'Set Legend Name', handler: this.applyFuncToEachWithInput('alias', 'Enter a legend label for this graph target', {quote: true})},
+                  {text: 'Color', handler: this.applyFuncToEachWithInput('color', 'Set the color for this graph target', {quote: true})},
                   {text: 'Aggregate By Sum', handler: this.applyFuncToEach('cumulative')},
                   {text: 'Draw non-zero As Infinite', handler: this.applyFuncToEach('drawAsInfinite')},
                   {text: 'Line Width', handler: this.applyFuncToEachWithInput('lineWidth', 'Please enter a line width for this graph target')},

=== modified file 'webapp/graphite/render/datalib.py'
--- webapp/graphite/render/datalib.py	2011-04-05 02:28:45 +0000
+++ webapp/graphite/render/datalib.py	2011-04-05 18:35:45 +0000
@@ -18,7 +18,7 @@
 from django.conf import settings
 from graphite.logger import log
 from graphite.storage import STORE, LOCAL_STORE
-from graphite.hashing import ConsistentHashRing
+from graphite.render.hashing import ConsistentHashRing
 
 try:
   import cPickle as pickle

=== modified file 'webapp/graphite/render/functions.py'
--- webapp/graphite/render/functions.py	2011-04-03 07:32:46 +0000
+++ webapp/graphite/render/functions.py	2011-04-05 18:35:45 +0000
@@ -343,6 +343,10 @@
     series.name = newName
   return seriesList
 
+def color(requestContext, seriesList, theColor):
+  for series in seriesList:
+    series.color = theColor
+  return seriesList
 
 def substr(requestContext, seriesList, start=0, stop=0):
   for series in seriesList:
@@ -764,6 +768,7 @@
 
   # Special functions
   'alias' : alias,
+  'color' : color,
   'cumulative' : cumulative,
   'keepLastValue' : keepLastValue,
   'drawAsInfinite' : drawAsInfinite,