mirror of
https://github.com/status-im/analytics-dash.git
synced 2025-02-23 06:58:18 +00:00
improve output path specification slightly better
This commit is contained in:
parent
23be904746
commit
1b19806d05
@ -56,12 +56,6 @@ def getUpdatesDaily(t):
|
|||||||
def plotData(filename, ylabel, timespan, x, y):
|
def plotData(filename, ylabel, timespan, x, y):
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import matplotlib.dates as mdates
|
import matplotlib.dates as mdates
|
||||||
from os.path import join
|
|
||||||
|
|
||||||
# TODO: No real cmdline parsing abstraction currently
|
|
||||||
from sys import argv
|
|
||||||
|
|
||||||
output_path = argv[1]
|
|
||||||
|
|
||||||
plt.clf()
|
plt.clf()
|
||||||
plt.gca().xaxis.set_major_formatter(mdates.DateFormatter("%Y-%m-%d"))
|
plt.gca().xaxis.set_major_formatter(mdates.DateFormatter("%Y-%m-%d"))
|
||||||
@ -76,17 +70,21 @@ def plotData(filename, ylabel, timespan, x, y):
|
|||||||
|
|
||||||
plt.plot(x, y)
|
plt.plot(x, y)
|
||||||
plt.gcf().autofmt_xdate()
|
plt.gcf().autofmt_xdate()
|
||||||
plt.savefig(join(output_path, filename), dpi=150)
|
plt.savefig(filename, dpi=150)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
from json import loads
|
from json import loads
|
||||||
|
from os.path import join
|
||||||
|
from sys import argv
|
||||||
|
|
||||||
|
getPath = lambda n: join(argv[1], n)
|
||||||
|
|
||||||
data = getData(loads(openURL("sales/dates/-120/0").read()))
|
data = getData(loads(openURL("sales/dates/-120/0").read()))
|
||||||
plotData("downloads_daily.png", "Downloads", "Daily", *getDownloadsDaily(data))
|
plotData(getPath("downloads_daily.png"), "Downloads", "Daily", *getDownloadsDaily(data))
|
||||||
plotData("updates_daily.png", "Updates", "Daily", *getUpdatesDaily(data))
|
plotData(getPath("updates_daily.png"), "Updates", "Daily", *getUpdatesDaily(data))
|
||||||
plotData("downloads_weekly.png", "Downloads", "Weekly", *getDownloadsWeekly(data))
|
plotData(getPath("downloads_weekly.png"), "Downloads", "Weekly", *getDownloadsWeekly(data))
|
||||||
plotData("updates_weekly.png", "Updates", "Weekly", *getUpdatesWeekly(data))
|
plotData(getPath("updates_weekly.png"), "Updates", "Weekly", *getUpdatesWeekly(data))
|
||||||
|
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user