index.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Nutrient Database Explorer</title>
<link rel="stylesheet" type="text/css" href="parallel.css" />
</head>
<body class="dark">
<div id="header">
<h1>Nutrient Explorer WebGL Test</h1>
<button title="Zoom in on selected data" id="keep-data" disabled="disabled">Keep</button>
<button title="Remove selected data" id="exclude-data" disabled="disabled">Exclude</button>
<button title="Export data as CSV" id="export-data">Export</button>
<div class="controls">
<strong id="selected-count"></strong>
<div class="fillbar"><div id="selected-bar"><div id="rendered-bar"> </div></div></div>
Lines at <strong id="opacity"></strong> opacity.
<span class="settings">
<button id="hide-ticks">Hide Ticks</button>
<button id="show-ticks" disabled="disabled">Show Ticks</button>
<button id="dark-theme" disabled="disabled">Dark</button>
<button id="light-theme">Light</button>
</span>
</div>
<div style="clear:both;"></div>
</div>
<div id="chart">
<canvas id="background"></canvas>
<canvas id="foreground"></canvas>
<canvas id="highlight"></canvas>
<svg></svg>
</div>
<div id="wrap">
<div class="third" id="controls">
<div class="bright">
<h3>What is this?</h3>
<p>
Experimenting with a WebGL renderer which is a drop in replacement for the Canvas renderer.
</p>
<p>
This is NOT a good example to work from, but WebGL Rendering will likely be supported soon in this <a href="//syntagmatic.github.com/parallel-coordinates/">parallel coordinates library</a>.
</p>
</div>
<div class="little-box">
<h3>Controls</h3>
<p>
<strong>Brush</strong>: Drag vertically along an axis.<br/>
<strong>Remove Brush</strong>: Tap the axis background.<br/>
<strong>Reorder Axes</strong>: Drag a label horizontally.<br/>
<strong>Invert Axis</strong>: Tap an axis label.<br/>
<strong>Remove Axis</strong>: Drag axis label to the left edge.<br/>
</p>
</div>
<div class="little-box">
<h3>Credits & License</h3>
<p>
<a href="https://github.com/gameclosure/webgl-2d">Webgl-2d</a>
</p>
<p>
Adapted from examples by<br/>
<a href="//bl.ocks.org/1341021">Mike Bostock</a> and <a href="//bl.ocks.org/1341281">Jason Davies</a><br/>
</p>
<p>
Copyright © 2012, Kai Chang<br/>
All rights reserved. Released under the <a href="//opensource.org/licenses/bsd-3-clause">BSD License</a>.
</p>
</p>
</div>
</div>
<div class="third">
<small>
</small>
<h3>Food Groups</h3>
<p id="legend">
</p>
</div>
<div class="third">
<h3>Sample of 25 entries <input type="text" id="search" placeholder="Search Foods..."></input></h3>
<p id="food-list">
</p>
</div>
</div>
</body>
<script src="//mbostock.github.com/d3/d3.v2.js"></script>
<script src="//documentcloud.github.com/underscore/underscore.js"></script>
<script src="webgl-2d.js"></script>
<script src="parallel.js"></script>
</html>
parallel.css
html, body {
margin: 0;
width: 100%;
height: 100%;
padding: 0;
}
body {
font-family: Ubuntu, Tahoma, Helvetica, sans-serif;
font-size: 12px;
line-height: 1.4em;
background: #f7f7f7;
color: #404040;
}
body.dark {
background: #131313;
color: #e3e3e3;
}
a {
text-decoration: none;
}
.dark a {
color: #5ae;
}
#wrap {
padding: 0 3.5%;
}
svg {
font-family: Ubuntu, Tahoma, Helvetica, sans-serif;
}
canvas, svg {
position: absolute;
top: 0;
left: 0;
}
#chart {
position: relative;
}
.brush rect.extent {
fill: rgba(100,100,100,0.15);
stroke: #fff;
}
.dark .brush rect.extent {
fill: rgba(100,100,100,0.15);
stroke: #ddd;
}
.brush:hover rect.extent {
stroke: #222;
stroke-dasharray: 5,5;
}
.brush rect.extent:hover {
stroke-dasharray: none;
}
.resize rect {
fill: none;
}
.background {
fill: none;
}
.dark .background {
fill: none;
}
.axis line, .axis path {
fill: none;
stroke: #777;
stroke-width: 1;
}
.dark .axis line, .dark .axis path {
stroke: #777;
}
.axis .tick {
width: 200px;
}
.axis text {
fill: #111;
text-anchor: right;
font-size: 11px;
text-shadow: 0 1px 0 #fff, 1px 0 0 #fff, 0 -1px 0 #fff, -1px 0 0 #fff;
}
.axis text.label {
font-size: 12px;
cursor: move;
padding-bottom: 24px;
}
.dark .axis text {
fill: #f2f2f2;
text-shadow: 0 1px 0 #000, 1px 0 0 #000, 0 -1px 0 #000, -1px 0 0 #000;
}
.dark .axis text.label {
fill: #ddd;
}
.quarter, .third, .half {
float: left;
}
.quarter {
width: 23%;
margin: 0 1%;
}
.third {
width: 31.3%;
margin: 0 1%;
}
.half {
width: 48%;
margin: 0 1%;
}
h3 {
margin: 12px 0 9px;
}
h3 small {
color: #888;
font-weight: normal;
}
p {
margin: 0.6em 0;
}
small {
line-height: 1.2em;
}
button[disabled=disabled] {
color: #555 !important;
opacity: 0.4;
}
.settings button[disabled=disabled] {
display: none;
}
.dark button[disabled=disabled] {
opacity: 0.2;
}
button#keep-data,
button#exclude-data {
font-weight:bold
}
button#keep-data:hover {
color: #080;
}
button#exclude-data:hover {
color: #900;
}
#food-list {
width: 100%;
height: 460px;
overflow-x: auto;
overflow-y: auto;
white-space: nowrap;
}
#legend {
text-align: left;
overflow-y: auto;
border-left: 1px solid rgba(140,140,140,0.5);
}
.row {
cursor: pointer;
}
.row:hover {
font-size: 16px;
line-height: 1.3em;
}
.off {
color: #999;
}
.dark .off {
color: #555;
}
.dark #legend {
border-left: 1px solid #777;
}
.color-block, .color-bar {
display: inline-block;
height: 8px;
width: 8px;
margin: 1px 4px 1px 0px;
}
#rendered-bar,
#selected-bar {
width:0%;
font-weight: bold;
}
#rendered-bar {
background: #888;
border-right: 1px solid #666;
}
#selected-bar {
background: rgba(160,160,160,0.5);
border-right: 1px solid #999;
}
.fillbar {
height: 12px;
line-height: 12px;
border:1px solid rgba(120,120,120,0.5);
width: 120px;
display: inline-block;
}
.little-box {
width: 268px;
float: left;
}
#header {
border-bottom: 1px solid rgba(100,100,100,0.35);
background: #e2e2e2;
padding: 6px 24px 4px;
line-height: 24px;
}
.dark #header {
background: #040404;
color: #f3f3f3;
}
#header h1 {
display: inline-block;
margin: 0px 14px 0 0;
}
#header button {
vertical-align: top;
}
.controls {
float: right;
height: 24px;
line-height: 24px;
}
::-webkit-scrollbar {
width: 10px;
height: 10px;
}
::-webkit-scrollbar-track {
background: #ddd;
border-radius: 12px;
}
::-webkit-scrollbar-thumb {
background: #b5b5b5;
border-radius: 12px;
}
.dark ::-webkit-scrollbar-track {
background: #222;
}
.dark ::-webkit-scrollbar-thumb {
background: #444;
}