Create keepLastValue() target function
Bug #379823 reported by
chrismd
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Graphite |
Fix Released
|
Undecided
|
kraig |
Bug Description
The keepLastValue() target function should change the rendering behavior for each series passed to it such that missing values are converted to the last known value preceding them.
Changed in graphite: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
This was a good idea. I found a lot of places to use this function.
diff --git a/composer_ widgets. js b/composer_ widgets. js widgets. js widgets. js oEachWithInput( 'mostDeviant' , "Draw the ___ metrics with the highest standard deviation")}, oEachWithInput( 'stdev' , "Draw the standard deviation for the last _ data points")}, oEachWithInput( 'offset' , "Draw the graph with an offset of _")}, oEach(' keepLastValue' )}, rCall.createDel egate(this) } *seriesLists) : pathExpression = name
index f50997a..cba0c4c 100644
--- a/composer_
+++ b/composer_
@@ -404,6 +404,7 @@ var TargetsWindow = { //This widget has a lot of state, so an object is appropri
{text: 'Most Deviant', handler: this.applyFuncT
{text: 'Standard Deviation', handler: this.applyFuncT
{text: 'Offset', handler: this.applyFuncT
+ {text: 'Keep Last Value', handler: this.applyFuncT
{text: 'Remove Outer Call', handler: this.removeOute
]
});
diff --git a/functions.py b/functions.py
index d18315c..9c0da17 100644
--- a/functions.py
+++ b/functions.py
@@ -93,6 +93,15 @@ def averageSeries(
series.
return [series]
+def keepLastValue( seriesList) : seriesList1, seriesList2orNu mber):
+ for series in seriesList:
+ series.name = "keepLastValue(%s)" % (series.name)
+ for i,value in enumerate(series):
+ if value is None:
+ value = series[i-1]
+ series[i] = value
+ return seriesList
+
def asPercent(
assert len(seriesList1) == 1, "asPercent series arguments must reference *exactly* 1 series"
series1 = seriesList1[0]
@@ -264,4 +273,5 @@ SeriesFunctions = {
'mostDeviant' : mostDeviant,
'stdev' : stdev,
'offset' : offset,
+ 'keepLastValue' : keepLastValue,
}