Skip to content

Commit

Permalink
Merge pull request ignoreintuition#109 from ignoreintuition/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
ignoreintuition authored Oct 31, 2018
2 parents 28f8b81 + 93b98c2 commit f13b102
Show file tree
Hide file tree
Showing 61 changed files with 447 additions and 13,865 deletions.
2 changes: 1 addition & 1 deletion dist/index.html
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.f304e2ab4d8ba945cb52a7708d244e45.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.204a476a59e23f5db787.js></script><script type=text/javascript src=/v-chart-plugin-demo/static/js/app.2faf389e8b9bc428e824.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.f304e2ab4d8ba945cb52a7708d244e45.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.204a476a59e23f5db787.js></script><script type=text/javascript src=/v-chart-plugin-demo/static/js/app.aebf041e861e5dad6c3e.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>
6 changes: 4 additions & 2 deletions dist/module/import/areaChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ var areaChart = function chart() {
* @description builds the scales for the x and y axes
*/
var buildScales = function buildScales() {
cs.y.scale = d3.scaleLinear().domain([0, _this.max]).range([_this.height - cs.x.axisHeight, _this.titleHeight]);
cs.y.scale = d3.scaleLinear().domain([0, _this.max]).range([_this.displayHeight - cs.x.axisHeight, _this.titleHeight]);
cs.y.axis = d3.axisLeft().ticks(10, 's').scale(cs.y.scale);
_this.ds.forEach(function (t) {
return cs.x.domain.push(t.dim);
Expand All @@ -94,7 +94,7 @@ var areaChart = function chart() {
return cs.y.scale(d.metric);
});
cs.x.xOffset = cs.y.axisWidth + 5;
cs.x.yOffset = _this.height - cs.x.axisHeight;
cs.x.yOffset = _this.displayHeight - cs.x.axisHeight;
cs.y.xOffset = cs.y.axisWidth;
cs.y.yOffset = 0;
svgContainer.append('g').append('g').attr('class', 'axis').attr('transform', 'translate(' + cs.x.xOffset + ', ' + cs.x.yOffset + ')').call(cs.x.axis);
Expand All @@ -106,6 +106,8 @@ var areaChart = function chart() {
enter(poly);
transition(poly);
exit(poly);

return cs;
};

export default areaChart;
10 changes: 6 additions & 4 deletions dist/module/import/barChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var barChart = function chart() {
* @description Returns height of the bar
*/
var getHeight = function getHeight() {
return (_this.height - cs.x.axisHeight - _this.header - cs.bar.vPadding) / _this.ds.length - 1;
return (_this.displayHeight - cs.x.axisHeight - _this.header - cs.bar.vPadding) / _this.ds.length - 1;
};

/**
Expand All @@ -56,7 +56,7 @@ var barChart = function chart() {
* @description Returns y axis co-ordinate of the bar
*/
var getYCoord = function getYCoord(d, i) {
return i * (_this.height - cs.x.axisHeight - _this.header) / _this.ds.length + 1 + _this.header;
return i * (_this.displayHeight - cs.x.axisHeight - _this.header) / _this.ds.length + 1 + _this.header;
};

/**
Expand Down Expand Up @@ -113,7 +113,7 @@ var barChart = function chart() {
return cs.y.domain.push(t.dim);
});
_this.ds.forEach(function (t, i) {
return cs.y.range.push((_this.chartData.height - cs.x.axisHeight - _this.header + cs.bar.vPadding) * i / _this.ds.length);
return cs.y.range.push((_this.displayHeight - cs.x.axisHeight - _this.header + cs.bar.vPadding) * i / _this.ds.length);
});
cs.y.scale = d3.scaleOrdinal().domain(cs.y.domain).range(cs.y.range);
};
Expand All @@ -124,7 +124,7 @@ var barChart = function chart() {
var drawAxis = function drawAxis() {
cs.x.axis = d3.axisBottom().ticks(cs.x.ticks, 's').scale(cs.x.scale);
cs.y.axis = d3.axisLeft().scale(cs.y.scale);
cs.x.yOffset = _this.height - cs.x.axisHeight;
cs.x.yOffset = _this.displayHeight - cs.x.axisHeight;
cs.x.xOffset = cs.bar.hPadding + cs.y.axisWidth;
cs.y.yOffset = cs.bar.vPadding + _this.header - 1;
cs.y.xOffset = cs.y.axisWidth;
Expand All @@ -146,6 +146,8 @@ var barChart = function chart() {
enter(rects);
transition(rects);
exit(rects);

return cs;
};

export default barChart;
6 changes: 4 additions & 2 deletions dist/module/import/lineGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ var lineGraph = function chart(mode) {
* @description builds the scales for the x and y axes
*/
var buildScales = function buildScales() {
cs.y.scale = d3.scaleLinear().domain([_this.min, _this.max]).range([_this.height - cs.x.axisHeight, _this.header]);
cs.y.scale = d3.scaleLinear().domain([_this.min, _this.max]).range([_this.displayHeight - cs.x.axisHeight, _this.header]);
cs.y.axis = d3.axisLeft().ticks(cs.y.ticks, 's').scale(cs.y.scale);
_this.ds.forEach(function (t) {
return cs.x.domain.push(t.dim);
Expand All @@ -101,7 +101,7 @@ var lineGraph = function chart(mode) {
var drawAxis = function drawAxis() {
cs.x.axis = d3.axisBottom().scale(cs.x.scale);
cs.x.xOffset = cs.y.axisWidth + 5;
cs.x.yOffset = _this.height - cs.x.axisHeight;
cs.x.yOffset = _this.displayHeight - cs.x.axisHeight;
cs.y.xOffset = cs.y.axisWidth;
cs.y.yOffset = 0;
};
Expand All @@ -128,6 +128,8 @@ var lineGraph = function chart(mode) {

svgContainer.append('g').append('g').attr('class', 'axis').attr('transform', 'translate(' + cs.x.xOffset + ', ' + cs.x.yOffset + ')').call(cs.x.axis);
svgContainer.append('g').append('g').attr('class', 'axis').attr('transform', 'translate(' + cs.y.xOffset + ',' + cs.y.yOffset + ')').call(cs.y.axis);

return cs;
};

export default lineGraph;
2 changes: 2 additions & 0 deletions dist/module/import/pieChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ var pieChart = function chart() {
enter(arc);
transition(arc);
exit(arc);

return cs;
};

export default pieChart;
4 changes: 3 additions & 1 deletion dist/module/import/scatterPlot.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ var scatterPlot = function chart() {
* @description builds the scales for the x and y axes
*/
var buildScales = function buildScales() {
cs.y.scale = d3.scaleLinear().domain([_this.min, _this.max]).range([_this.height - cs.x.axisHeight, _this.header]);
cs.y.scale = d3.scaleLinear().domain([_this.min, _this.max]).range([_this.displayHeight - cs.x.axisHeight, _this.header]);
cs.y.axis = d3.axisLeft().ticks(cs.y.ticks, 's').scale(cs.y.scale);
_this.ds.forEach(function (t) {
return cs.x.domain.push(t.dim);
Expand Down Expand Up @@ -102,6 +102,8 @@ var scatterPlot = function chart() {
enter(points);
transition(points);
exit(points);

return cs;
};

export default scatterPlot;
8 changes: 5 additions & 3 deletions dist/module/import/vBarChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var vBarChart = function chart() {
* @description Returns height of the bar
*/
var getHeight = function getHeight(d) {
return _this.height - cs.y.scale(d.metric);
return _this.displayHeight - cs.y.scale(d.metric);
};

/**
Expand Down Expand Up @@ -114,7 +114,7 @@ var vBarChart = function chart() {
* @description builds the scales for the x and y axes
*/
var buildScales = function buildScales() {
cs.y.scale = d3.scaleLinear().domain([0, _this.max]).range([_this.height, _this.header]);
cs.y.scale = d3.scaleLinear().domain([0, _this.max]).range([_this.displayHeight, _this.header]);
_this.ds.forEach(function (t) {
return cs.x.domain.push(t.dim);
});
Expand All @@ -130,7 +130,7 @@ var vBarChart = function chart() {
var drawAxis = function drawAxis() {
cs.y.axis = d3.axisLeft().ticks(cs.y.ticks, 's').scale(cs.y.scale);
cs.x.axis = d3.axisBottom().scale(cs.x.scale);
cs.x.yOffset = _this.height;
cs.x.yOffset = _this.displayHeight;
cs.x.xOffset = cs.y.axisWidth;
cs.y.yOffset = 0;
cs.y.xOffset = cs.y.axisWidth;
Expand All @@ -146,6 +146,8 @@ var vBarChart = function chart() {
enter(rects);
transition(rects);
exit(rects);

return cs;
};

export default vBarChart;
26 changes: 20 additions & 6 deletions dist/module/v-chart-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ var Chart = {
* @description Generate a new Chart of type chartType
*/
initalizeChart: function initalizeChart() {
var cs = this[this.chartData.chartType]('init');
this.drawTitle();
this.generateLegend();
this[this.chartData.chartType]('init');
this.generateLegend(cs);
},

/**
Expand Down Expand Up @@ -141,12 +141,13 @@ var Chart = {
* @method generateLegend
* @description generate legend if option -legends- defined as true
*/
generateLegend: function generateLegend() {
generateLegend: function generateLegend(cs) {
if (this.chartData.legends && this.chartData.legends.enabled === true) {
d3.select('#' + this.chartData.selector).append('text').attr('x', this.width - 60).attr('y', this.titleHeight - this.titleHeight * 0.1 - 10).style('text-anchor', 'middle').text(this.chartData.metric);
d3.select('#' + this.chartData.selector).append('text').attr('x', this.width - 60).attr('y', this.height * 0.95).style('text-anchor', 'middle').text(this.chartData.metric);

d3.select('#' + this.chartData.selector).append("g").attr("class", "legends").append("rect").attr('x', this.width - 30).attr('y', this.titleHeight - this.titleHeight * 0.1 - 20).attr("width", 30).attr("height", 10).style("fill", function () {
return '#005792';
d3.select('#' + this.chartData.selector).append("g").attr("class", "legends").append("rect").attr('x', this.width - 30).attr('y', this.height * 0.95 - 10).attr("width", 30).attr("height", 10).style("fill", function () {
var fill = cs.palette.lineFill || cs.palette.fill;
return fill;
});
}
}
Expand Down Expand Up @@ -220,6 +221,19 @@ var Chart = {
return 0;
},

/**
* @method displayHeight
* @description Computed.
* @returns {number} Height of the chart display
*/
displayHeight: function displayHeight() {
if (this.chartData.legends && this.chartData.legends.enabled === true) {
return this.height * .80;
} else {
return this.height;
}
},

/**
* @method subtitleHeight
* @description Computed.
Expand Down
2 changes: 0 additions & 2 deletions dist/static/js/app.2faf389e8b9bc428e824.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/static/js/app.2faf389e8b9bc428e824.js.map

This file was deleted.

2 changes: 2 additions & 0 deletions dist/static/js/app.aebf041e861e5dad6c3e.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/static/js/app.aebf041e861e5dad6c3e.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit f13b102

Please sign in to comment.