mirror of
https://github.com/TBEDP/datavjs.git
synced 2025-12-08 19:45:52 +00:00
89 lines
2.7 KiB
HTML
89 lines
2.7 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
|
|
<title>Parallel Coordinates</title>
|
|
<style type="text/css">
|
|
/*
|
|
svg {
|
|
font: 10px sans-serif;
|
|
}
|
|
|
|
.background path {
|
|
fill: none;
|
|
stroke: #ccc;
|
|
stroke-opacity: .4;
|
|
shape-rendering: crispEdges;
|
|
}
|
|
|
|
.foreground path {
|
|
fill: none;
|
|
stroke: steelblue;
|
|
stroke-opacity: .7;
|
|
}
|
|
|
|
.brush .extent {
|
|
fill-opacity: .3;
|
|
stroke: #fff;
|
|
shape-rendering: crispEdges;
|
|
}
|
|
|
|
.axis line, .axis path {
|
|
fill: none;
|
|
stroke: #000;
|
|
shape-rendering: crispEdges;
|
|
}
|
|
|
|
.axis text {
|
|
text-shadow: 0 1px 0 #fff;
|
|
}
|
|
*/
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<script type="text/javascript" src="../../deps/d3.js"></script>
|
|
<script type="text/javascript" src="../../deps/raphael.min.js"></script>
|
|
<script type="text/javascript" src="../../deps/jquery-1.7.1.min.js"></script>
|
|
<script type="text/javascript" src="../../lib/datav.js"></script>
|
|
<script type="text/javascript" src="../../lib/charts/parallel.js"></script>
|
|
|
|
<div id="chart"></div>
|
|
<p>brushstart</p>
|
|
<div id="info_brushstart"></div>
|
|
<p>brush</p>
|
|
<div id="info_brush"></div>
|
|
<p>brushend</p>
|
|
<div id="info_brushend"></div>
|
|
<script type="text/javascript">
|
|
|
|
|
|
var parallel = new Parallel("chart", {"width": 950, "height": 500});
|
|
|
|
DataV.csv("cars.csv", function(dataSource) {
|
|
var domains;
|
|
parallel.setSource(dataSource);
|
|
//parallel.chooseDimensions(["name", "name", "economy (mpg)"]);
|
|
parallel.chooseDimensions(["economy (mpg)", "cylinders", "displacement (cc)", "power (hp)", "weight (lb)", "0-60 mph (s)", "year"]);
|
|
parallel.setDimensionType({"cylinders": "ordinal"});
|
|
domains = parallel.getDimensionDomains();
|
|
parallel.setDimensionDomain({"cylinders": domains["cylinders"].sort(d3.ascending),
|
|
"economy (mpg)": domains["economy (mpg)"].reverse()});
|
|
parallel.setDimensionExtent({"cylinders": ["6", "3"], "economy (mpg)": [35, 20] });
|
|
|
|
parallel.on("brushstart", function() {
|
|
$("#info_brushstart").html(JSON.stringify(this.statistic));
|
|
});
|
|
parallel.on("brush", function() {
|
|
$("#info_brush").html(JSON.stringify(this.statistic));
|
|
});
|
|
parallel.on("brushend", function() {
|
|
$("#info_brushend").html(JSON.stringify(this.statistic));
|
|
});
|
|
parallel.render();
|
|
//parallel.setDimensionExtent({"economy (mpg)": [29, 20], "cylinders": ["6", "4"]});//??
|
|
});
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|