Commit 3bfbc01b authored by Administrator's avatar Administrator

[FEATURE] Dynamic graph to select documents in time series.

parent 99808934
......@@ -4,8 +4,8 @@ from django.contrib import admin
from gargantext_web.views import home, projects, project, corpus
from gargantext_web.views import delete_project, delete_corpus
from gargantext_web.views import exploration
from gargantext_web.views import explorer_graph, explorer_matrix
from gargantext_web.views import exploration, send_csv
from gargantext_web.views import explorer_graph, explorer_matrix, explorer_chart
admin.autodiscover()
......@@ -27,9 +27,12 @@ urlpatterns = patterns('',
url(r'^project/(\d+)/corpus/(\d+)/delete/$', delete_corpus),
url(r'^graph$', explorer_graph),
url(r'^chart$', explorer_chart),
url(r'^matrix$', explorer_matrix),
url(r'^exploration$', exploration),
url(r'^data.csv$', send_csv),
)
from django.conf import settings
......
......@@ -401,5 +401,60 @@ def exploration(request):
return HttpResponse(html)
def explorer_chart(request):
t = get_template('chart.html')
user = request.user
date = datetime.datetime.now()
html = t.render(Context({\
'user': user,\
'date': date,\
}))
return HttpResponse(html)
import csv
def send_csv(request):
'''
Create the HttpResponse object with the appropriate CSV header.
'''
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="somefilename.csv"'
writer = csv.writer(response)
# file = open('/srv/gargantext/static/js/d3/ndx.csv', 'r')
# for line in file.readlines():
# writer.writerow(line)
writer.writerow(['date','open','high','low','close','volume','oi'])
writer.writerow(['12/19/2001','96.05','99.98','95.79','99.98','1260','0'])
writer.writerow(['12/20/2001','104.3','104.39','99.98','104.39','197','0'])
writer.writerow(['12/21/2001','109.07','109.13','103.73','109.13','28','0'])
writer.writerow(['12/24/2001','113.57','114.55','109.13','114.55','32','0'])
writer.writerow(['12/25/2001','120.09','120.25','114.55','120.25','15','0'])
writer.writerow(['12/26/2001','125.27','125.27','120.25','125.27','100','0'])
writer.writerow(['12/19/2002','96.05','99.98','95.79','99.98','1260','0'])
writer.writerow(['12/20/2002','104.3','104.39','99.98','104.39','197','0'])
writer.writerow(['12/21/2002','109.07','109.13','103.73','109.13','28','0'])
writer.writerow(['12/24/2002','113.57','114.55','109.13','114.55','32','0'])
writer.writerow(['12/25/2002','120.09','120.25','114.55','120.25','15','0'])
writer.writerow(['12/26/2002','125.27','125.27','120.25','125.27','100','0'])
writer.writerow(['12/19/2003','96.05','99.98','95.79','99.98','1260','0'])
writer.writerow(['12/20/2003','104.3','104.39','99.98','104.39','197','0'])
writer.writerow(['12/21/2003','109.07','109.13','103.73','109.13','28','0'])
writer.writerow(['12/24/2003','113.57','114.55','109.13','114.55','32','0'])
writer.writerow(['12/25/2003','120.09','120.25','114.55','120.25','15','0'])
writer.writerow(['12/26/2003','125.27','125.27','120.25','125.27','100','0'])
writer.writerow(['12/19/2004','96.05','99.98','95.79','99.98','1260','0'])
writer.writerow(['12/20/2004','104.3','104.39','99.98','104.39','197','0'])
writer.writerow(['12/21/2004','109.07','109.13','103.73','109.13','28','0'])
writer.writerow(['12/24/2004','113.57','114.55','109.13','114.55','32','0'])
writer.writerow(['12/25/2004','120.09','120.25','114.55','120.25','15','0'])
writer.writerow(['12/26/2004','125.27','125.27','120.25','125.27','100','0'])
return response
This diff is collapsed.
This diff is collapsed.
{% extends "menu.html" %}
{% block css %}
{% load staticfiles %}
<link rel="stylesheet" href="{% static "css/bootstrap.css" %}">
<link rel="stylesheet" href="{% static "css/bootstrap-theme.min.css" %}">
<link rel="stylesheet" type="text/css" href="http://jun9.github.io/dc.js/css/dc.css"/>
<script type="text/javascript" src="http://jun9.github.io/dc.js/js/d3.js"></script>
<script type="text/javascript" src="http://jun9.github.io/dc.js/js/crossfilter.js"></script>
<script type="text/javascript" src="http://jun9.github.io/dc.js/js/dc.js"></script>
{% endblock %}
{% block content %}
<div class="container theme-showcase" role="main">
<div class="jumbotron">
<div class="container">
<div class="row">
<div id="monthly-move-chart">
<strong>Title</strong> (Blue Line: Avg Index, Green Line: Index
Fluctuation)
<a class="reset" href="javascript:volumeChart.filterAll();dc.redrawAll();"
style="display: none;">reset</a>
<div class="clearfix"></div>
</div>
</div>
<div class="row">
<div id="monthly-volume-chart">
</div>
<p class="muted pull-left" style="margin-right: 15px;">Select a time range to zoom in</p>
</div>
</div>
</div>
</div>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://jun9.github.io/dc.js/js/bootstrap.min.js"></script>
<script src="{% static "js/d3/DC.js"%}"></script>
{% endblock %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment