Yurik has uploaded a new change for review.
https://gerrit.wikimedia.org/r/201645
Change subject: Insert leading zeroes for all stacked graphs
......................................................................
Insert leading zeroes for all stacked graphs
Change-Id: I716a2ed63353bd66a4522609ff8321419437cfb3
---
M scripts/weblogs2.py
1 file changed, 10 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/analytics/zero-sms
refs/changes/45/201645/1
diff --git a/scripts/weblogs2.py b/scripts/weblogs2.py
index 7481053..334d249 100644
--- a/scripts/weblogs2.py
+++ b/scripts/weblogs2.py
@@ -77,14 +77,24 @@
lastDate = None
prev, dt, nxt = None, None, None
extraLines = []
+ # Insert two zero values for each category for each xcs - one for the
earliest day of the xcs data,
+ # and one - in the period preceding first available data point of that
series
+ firstDate = {}
for line in lines:
date = line[0]
+ if line[1] not in firstDate:
+ firstDate[line[1]] = date
if lastDate != date:
prev, dt, nxt = dateFunc(date, True)
lastDate = date
key = tuple(line[1:-1])
if key not in stats:
stats[key] = dt
+ firstDt = firstDate[line[1]]
+ if firstDt < date:
+ extraLines.append([firstDt] + list(key) + ['0'])
+ if firstDt != prev:
+ extraLines.append([prev] + list(key) + ['0'])
else:
lastDt = stats[key]
if lastDt < prev:
--
To view, visit https://gerrit.wikimedia.org/r/201645
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I716a2ed63353bd66a4522609ff8321419437cfb3
Gerrit-PatchSet: 1
Gerrit-Project: analytics/zero-sms
Gerrit-Branch: master
Gerrit-Owner: Yurik <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits