From 21724a06eec89d6a4071372dc480412978ccf702 Mon Sep 17 00:00:00 2001 From: "Wade Fagen-Ulmschneider (waf)" <waf@illinois.edu> Date: Tue, 7 Mar 2017 12:49:01 -0600 Subject: [PATCH] project_uiuc --- project_uiuc/project.json | 5 +++++ project_uiuc/py/compute.py | 4 ++++ project_uiuc/res/.keep | 1 + project_uiuc/web/index.html | 9 +++++++++ project_uiuc/web/vis.js | 37 +++++++++++++++++++++++++++++++++++++ 5 files changed, 56 insertions(+) create mode 100644 project_uiuc/project.json create mode 100644 project_uiuc/py/compute.py create mode 100644 project_uiuc/res/.keep create mode 100644 project_uiuc/web/index.html create mode 100644 project_uiuc/web/vis.js diff --git a/project_uiuc/project.json b/project_uiuc/project.json new file mode 100644 index 0000000..1dd8dd1 --- /dev/null +++ b/project_uiuc/project.json @@ -0,0 +1,5 @@ +{ + "title": "Project #1: UIUC Datasets", + "index": 20170307, + "type": "Project" +} diff --git a/project_uiuc/py/compute.py b/project_uiuc/py/compute.py new file mode 100644 index 0000000..3a20702 --- /dev/null +++ b/project_uiuc/py/compute.py @@ -0,0 +1,4 @@ +import csv +import json + +# There's no need for any Python here. diff --git a/project_uiuc/res/.keep b/project_uiuc/res/.keep new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/project_uiuc/res/.keep @@ -0,0 +1 @@ + diff --git a/project_uiuc/web/index.html b/project_uiuc/web/index.html new file mode 100644 index 0000000..e6252ff --- /dev/null +++ b/project_uiuc/web/index.html @@ -0,0 +1,9 @@ +{% extends "static/templates/projectBase.html" %} +{% block projectContent %} + +<h2>Project #1</h2> +<div id="chart"></div> + +<script src="web/vis.js"></script> + +{% endblock %} diff --git a/project_uiuc/web/vis.js b/project_uiuc/web/vis.js new file mode 100644 index 0000000..4e33390 --- /dev/null +++ b/project_uiuc/web/vis.js @@ -0,0 +1,37 @@ +"use strict"; + +/* Boilerplate jQuery */ +$(function() { + $.get("res/fileName.csv") + .done(function (csvData) { + var data = d3.parseCsv(csvData); + visualize(data); + }) + .fail(function(e) { + alert("Failed to load CSV file!"); + }); +}); + +/* Visualize the data in the visualize function */ +var visualize = function(data) { + console.log(data); + + // == BOILERPLATE == + var margin = { top: 50, right: 50, bottom: 50, left: 50 }, + width = 800 - margin.left - margin.right, + height = (data.length * 20); + + 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 + ")"); + + + + // == Your code! :) == + +}; -- GitLab