diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ee9cf04 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +./sports1.txt \ No newline at end of file diff --git a/template.py b/dashboard.py similarity index 65% rename from template.py rename to dashboard.py index edcfb4c..5574203 100644 --- a/template.py +++ b/dashboard.py @@ -1,18 +1,20 @@ from eca import * +from eca.generators import start_offline_tweets import random ## You might have to update the root path to point to the correct path ## (by default, it points to _static) -# root_content_path = 'template_static' +root_content_path = 'dashboard_static' # binds the 'setup' function as the action for the 'init' event # the action will be called with the context and the event @event('init') def setup(ctx, e): + start_offline_tweets('sports1.txt', event_name="sample") ctx.count = 0 - fire('sample', {'previous': 0.0}) + # fire('sample', {'previous': 0.0}) # define a normal Python function @@ -24,16 +26,16 @@ def generate_sample(ctx, e): ctx.count += 1 if ctx.count % 50 == 0: emit('debug', {'text': 'Log message #'+str(ctx.count)+'!'}) - + tweet = e.data + print(tweet) # base sample on previous one - sample = clip(-100, e.data['previous'] + random.uniform(+5.0, -5.0), 100) - + # sample = clip(-100, e.data['previous'] + random.uniform(+5.0, -5.0), 100) # emit to outside world emit('sample',{ 'action': 'add', - 'value': sample + 'value': tweet }) # chain event - fire('sample', {'previous': sample}, delay=0.05) + fire('sample', {'previous': tweet}, delay=0.05) diff --git a/template_static/index.html b/dashboard_static/index.html similarity index 100% rename from template_static/index.html rename to dashboard_static/index.html diff --git a/template_static/lib/charts.js b/dashboard_static/lib/charts.js similarity index 100% rename from template_static/lib/charts.js rename to dashboard_static/lib/charts.js diff --git a/template_static/lib/core.js b/dashboard_static/lib/core.js similarity index 100% rename from template_static/lib/core.js rename to dashboard_static/lib/core.js diff --git a/template_static/lib/form.js b/dashboard_static/lib/form.js similarity index 100% rename from template_static/lib/form.js rename to dashboard_static/lib/form.js diff --git a/template_static/lib/jqcloud-1.0.4.js b/dashboard_static/lib/jqcloud-1.0.4.js similarity index 100% rename from template_static/lib/jqcloud-1.0.4.js rename to dashboard_static/lib/jqcloud-1.0.4.js diff --git a/template_static/lib/jquery-2.1.1.min.js b/dashboard_static/lib/jquery-2.1.1.min.js similarity index 100% rename from template_static/lib/jquery-2.1.1.min.js rename to dashboard_static/lib/jquery-2.1.1.min.js diff --git a/template_static/lib/jquery.flot.categories.min.js b/dashboard_static/lib/jquery.flot.categories.min.js similarity index 100% rename from template_static/lib/jquery.flot.categories.min.js rename to dashboard_static/lib/jquery.flot.categories.min.js diff --git a/template_static/lib/jquery.flot.min.js b/dashboard_static/lib/jquery.flot.min.js similarity index 100% rename from template_static/lib/jquery.flot.min.js rename to dashboard_static/lib/jquery.flot.min.js diff --git a/template_static/lib/jquery.flot.pie.js b/dashboard_static/lib/jquery.flot.pie.js similarity index 100% rename from template_static/lib/jquery.flot.pie.js rename to dashboard_static/lib/jquery.flot.pie.js diff --git a/template_static/lib/log.js b/dashboard_static/lib/log.js similarity index 100% rename from template_static/lib/log.js rename to dashboard_static/lib/log.js diff --git a/template_static/lib/tweets.js b/dashboard_static/lib/tweets.js similarity index 100% rename from template_static/lib/tweets.js rename to dashboard_static/lib/tweets.js diff --git a/template_static/lib/wordcloud.js b/dashboard_static/lib/wordcloud.js similarity index 100% rename from template_static/lib/wordcloud.js rename to dashboard_static/lib/wordcloud.js diff --git a/template_static/style/grid.css b/dashboard_static/style/grid.css similarity index 100% rename from template_static/style/grid.css rename to dashboard_static/style/grid.css diff --git a/template_static/style/layout.css b/dashboard_static/style/layout.css similarity index 100% rename from template_static/style/layout.css rename to dashboard_static/style/layout.css diff --git a/template_static/style/theme.css b/dashboard_static/style/theme.css similarity index 100% rename from template_static/style/theme.css rename to dashboard_static/style/theme.css diff --git a/template_static/style/wordcloud.css b/dashboard_static/style/wordcloud.css similarity index 100% rename from template_static/style/wordcloud.css rename to dashboard_static/style/wordcloud.css