From c65dc1bff15bd5a6356b71870b14aa0c8c0cc33c Mon Sep 17 00:00:00 2001
From: "Wade Fagen (waf)" <waf@illinois.edu>
Date: Mon, 16 Jan 2017 17:44:55 -0600
Subject: [PATCH] "New Discovery" feature

---
 static/newDirFiles/project.json   |  5 ++++
 static/newDirFiles/py/compute.py  |  2 ++
 static/newDirFiles/web/index.html |  9 +++++++
 static/newDirFiles/web/vis.js     | 42 +++++++++++++++++++++++++++++++
 4 files changed, 58 insertions(+)
 create mode 100644 static/newDirFiles/project.json
 create mode 100644 static/newDirFiles/py/compute.py
 create mode 100644 static/newDirFiles/web/index.html
 create mode 100644 static/newDirFiles/web/vis.js

diff --git a/static/newDirFiles/project.json b/static/newDirFiles/project.json
new file mode 100644
index 0000000..a5df1e2
--- /dev/null
+++ b/static/newDirFiles/project.json
@@ -0,0 +1,5 @@
+{
+	"title": "{{TITLE}}",
+	"index": {{INDEX}},
+	"type": "{{TYPE}}"
+}
diff --git a/static/newDirFiles/py/compute.py b/static/newDirFiles/py/compute.py
new file mode 100644
index 0000000..4f0baf4
--- /dev/null
+++ b/static/newDirFiles/py/compute.py
@@ -0,0 +1,2 @@
+import csv
+import json
diff --git a/static/newDirFiles/web/index.html b/static/newDirFiles/web/index.html
new file mode 100644
index 0000000..cd5f9a7
--- /dev/null
+++ b/static/newDirFiles/web/index.html
@@ -0,0 +1,9 @@
+{% extends "templates/projectBase.html" %}
+{% block projectContent %}
+
+<h2></h2>
+
+<div id="chart" style="margin: 0px auto; text-align: center;"></div>
+<script src="web/vis.js"></script>
+
+{% endblock %}
diff --git a/static/newDirFiles/web/vis.js b/static/newDirFiles/web/vis.js
new file mode 100644
index 0000000..a6d471c
--- /dev/null
+++ b/static/newDirFiles/web/vis.js
@@ -0,0 +1,42 @@
+// Asks JavaScript to show more errors.
+"use strict";
+
+/*
+ * # Boilerplate jQuery
+ * This code loads the file `res/scores.json` and calls the `visualize` function
+ * as soon as the JSON file is loaded.
+ */
+ $(function() {
+   $.getJSON("res/data.json")
+    .done(function (data) { visualize(data); })
+    .fail(function() { alert("Failed to load the JSON file!\n(Did your Python run?)"); });
+ });
+
+/*
+ * # d3.js visualization
+ * All of the code to create our visualization will be contained in the `visualize` function,
+ * which is called once the data for the visualization has been loaded by the boilerplate
+ * jQuery code.
+ */
+var visualize = function(data) {
+  /*
+   * # Boilerplate Code for d3.js
+   */
+  var margin = { top: 20, right: 20, bottom: 20, left: 20 },
+     width = 800 - margin.left - margin.right,
+     height = 970 - margin.top - margin.bottom;
+
+  var svg = d3.select("#chart")
+              .append("svg")
+              .attr("width", width + margin.left + margin.right)
+              .attr("height", height + margin.top + margin.bottom)
+              .style("width", width + margin.left + margin.right)
+              .style("height", height + margin.top + margin.bottom)
+              .append("g")
+              .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
+
+  /*
+   * #
+   */
+
+};
-- 
GitLab