-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #155 from ignoreintuition/development
Development
- Loading branch information
Showing
65 changed files
with
15,226 additions
and
824 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel=stylesheet href=https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css integrity=sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm crossorigin=anonymous><title>v-chart-plugin</title><link href=/v-chart-plugin-demo/static/css/app.54d64245c93f07f8de1551bc966830b4.css rel=stylesheet></head><body bgcolor=yellow><div id=app></div><script type=text/javascript src=/v-chart-plugin-demo/static/js/manifest.c423efaf7696a83d1404.js></script><script type=text/javascript src=/v-chart-plugin-demo/static/js/vendor.ea0c2a26400e96edf6cc.js></script><script type=text/javascript src=/v-chart-plugin-demo/static/js/app.2a5b3d2ecf41d1ed0f6f.js></script></body><script src=https://code.jquery.com/jquery-3.2.1.slim.min.js integrity=sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN crossorigin=anonymous></script><script src=https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js integrity=sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q crossorigin=anonymous></script><script src=https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js integrity=sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl crossorigin=anonymous></script></html> | ||
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel=stylesheet href=https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css integrity=sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm crossorigin=anonymous><title>v-chart-plugin</title><link href=/v-chart-plugin-demo/static/css/app.54d64245c93f07f8de1551bc966830b4.css rel=stylesheet></head><body bgcolor=yellow><div id=app></div><script type=text/javascript src=/v-chart-plugin-demo/static/js/manifest.c423efaf7696a83d1404.js></script><script type=text/javascript src=/v-chart-plugin-demo/static/js/vendor.ea0c2a26400e96edf6cc.js></script><script type=text/javascript src=/v-chart-plugin-demo/static/js/app.a391d398da741e3a07d3.js></script></body><script src=https://code.jquery.com/jquery-3.2.1.slim.min.js integrity=sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN crossorigin=anonymous></script><script src=https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js integrity=sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q crossorigin=anonymous></script><script src=https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js integrity=sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl crossorigin=anonymous></script></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
import _Object$assign from 'babel-runtime/core-js/object/assign'; | ||
import { globalAgent } from 'http'; | ||
|
||
/** | ||
* @fileOverview Bar chart component definition | ||
* | ||
* @author Brian Greig | ||
* | ||
* @requires NPM:d3:Vue | ||
* @requires src/v-chart-plugin.js | ||
*/ | ||
|
||
/* eslint-env browser */ | ||
var d3 = _Object$assign({}, require('d3-selection'), require('d3-scale'), require('d3-axis'), require('d3-ease'), require('d3-array')); | ||
/** | ||
* Builds a Box Plot. | ||
* @module boxPlot | ||
*/ | ||
|
||
var boxPlot = function chart() { | ||
var _this = this; | ||
|
||
/** | ||
* The SVG that stores the chart | ||
* @member svgContainer | ||
*/ | ||
var svgContainer = d3.select('#' + this.chartData.selector); | ||
/** | ||
* The configuration of the coordinate system | ||
* @member cs | ||
*/ | ||
var cs = { | ||
palette: { | ||
fill: ['#005792', '#ffcdcd'], | ||
stroke: '#d1f4fa' | ||
}, | ||
x: { | ||
axisHeight: 10, | ||
ticks: 5 | ||
}, | ||
y: { | ||
axisWidth: 10, | ||
ticks: 5 | ||
} | ||
}; | ||
|
||
/** | ||
* Runs when a new element is added to the dataset | ||
* @member enter | ||
* @function | ||
* @param {Object} boxes (svg element) | ||
*/ | ||
var enter = function enter(boxes, lines) { | ||
boxes.enter().append('rect').attr('fill', 'none').attr('stroke', 'black').attr('stroke-width', 3).attr('class', _this.selector).attr('width', 50).attr('height', function (d) { | ||
return cs.y.scale(d.thirdQrt) - cs.y.scale(d.firstQrt); | ||
}).attr('x', 50).attr('y', function (d) { | ||
return cs.y.scale(d.firstQrt); | ||
}); | ||
|
||
var l = lines.enter(); | ||
|
||
l.append('line').attr('fill', 'none').attr('stroke', 'black').attr('stroke-width', 3).attr('x1', 75).attr('y1', function (d) { | ||
return cs.y.scale(d.min); | ||
}).attr('x2', 75).attr('y2', function (d) { | ||
return cs.y.scale(d.firstQrt); | ||
}); | ||
|
||
l.append('line').attr('fill', 'none').attr('stroke', 'black').attr('stroke-width', 3).attr('x1', 75).attr('y1', function (d) { | ||
return cs.y.scale(d.thirdQrt); | ||
}).attr('x2', 75).attr('y2', function (d) { | ||
return cs.y.scale(d.max); | ||
}); | ||
|
||
l.append('line').attr('fill', 'none').attr('stroke', 'black').attr('stroke-width', 3).attr('x1', 50).attr('y1', function (d) { | ||
return cs.y.scale(d.median); | ||
}).attr('x2', 100).attr('y2', function (d) { | ||
return cs.y.scale(d.median); | ||
}); | ||
|
||
l.append('line').attr('fill', 'none').attr('stroke', 'black').attr('stroke-width', 3).attr('x1', 50).attr('y1', function (d) { | ||
return cs.y.scale(d.min); | ||
}).attr('x2', 100).attr('y2', function (d) { | ||
return cs.y.scale(d.min); | ||
}); | ||
|
||
l.append('line').attr('fill', 'none').attr('stroke', 'black').attr('stroke-width', 3).attr('x1', 50).attr('y1', function (d) { | ||
return cs.y.scale(d.max); | ||
}).attr('x2', 100).attr('y2', function (d) { | ||
return cs.y.scale(d.max); | ||
}); | ||
|
||
return boxes; | ||
}; | ||
/** | ||
* Runs when a value of an element in dataset is changed | ||
* @member transition | ||
* @function | ||
* @param {Object} boxes (svg element) | ||
*/ | ||
var transition = function transition(boxes) { | ||
boxes.transition(); | ||
return boxes; | ||
}; | ||
/** | ||
* Runs when an element is removed from the dataset | ||
* @member exit | ||
* @function | ||
* @param {Object} boxes (svg element) | ||
*/ | ||
var exit = function exit(rects) { | ||
boxes.exit().remove(); | ||
return rects; | ||
}; | ||
/** | ||
* Builds the scales for the x and y axes | ||
* @member buildScales | ||
* @function | ||
*/ | ||
var buildScales = function buildScales() { | ||
cs.y.scale = d3.scaleLinear().domain([_this.min * 0.95, _this.max * 1.05]).range([_this.header, _this.displayHeight]); | ||
}; | ||
/** | ||
* Draws the x and y axes on the svg | ||
* @member drawAxis | ||
* @function | ||
*/ | ||
var drawAxis = function drawAxis() {}; | ||
|
||
var ds = this.metricAsArray('total').sort(); | ||
var a = [{ | ||
min: this.min, | ||
median: d3.quantile(ds, 0.5), | ||
max: this.max, | ||
firstQrt: d3.quantile(ds, 0.25), | ||
thirdQrt: d3.quantile(ds, 0.75) | ||
}]; | ||
|
||
var boxes = svgContainer.selectAll('rect').data(a); | ||
var lines = svgContainer.selectAll('line').data(a); | ||
|
||
cs = this.setOverrides(cs, this.chartData.overrides); | ||
buildScales(cs); | ||
drawAxis(cs); | ||
enter(boxes, lines); | ||
transition(boxes, lines); | ||
exit(boxes, lines); | ||
|
||
return cs; | ||
}; | ||
|
||
export default boxPlot; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.