diff --git a/static/newDirFiles/project.json b/static/newDirFiles/project.json new file mode 100644 index 0000000000000000000000000000000000000000..a5df1e2640410a65f005461c61adf7e738ca7084 --- /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 0000000000000000000000000000000000000000..4f0baf434ff8f85aad0c120e6e32fe94e0796d68 --- /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 0000000000000000000000000000000000000000..cd5f9a7aeec4e5c006709a01eb30ad957fdc4007 --- /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 0000000000000000000000000000000000000000..a6d471cdcab135cf4dcaf06dc63e70111742d141 --- /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 + ")"); + + /* + * # + */ + +};