Skip to content

Commit f13b102

Browse files
Merge pull request #109 from ignoreintuition/development
Development
2 parents 28f8b81 + 93b98c2 commit f13b102

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+447
-13865
lines changed

dist/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +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>
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.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>

dist/module/import/areaChart.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ var areaChart = function chart() {
7272
* @description builds the scales for the x and y axes
7373
*/
7474
var buildScales = function buildScales() {
75-
cs.y.scale = d3.scaleLinear().domain([0, _this.max]).range([_this.height - cs.x.axisHeight, _this.titleHeight]);
75+
cs.y.scale = d3.scaleLinear().domain([0, _this.max]).range([_this.displayHeight - cs.x.axisHeight, _this.titleHeight]);
7676
cs.y.axis = d3.axisLeft().ticks(10, 's').scale(cs.y.scale);
7777
_this.ds.forEach(function (t) {
7878
return cs.x.domain.push(t.dim);
@@ -94,7 +94,7 @@ var areaChart = function chart() {
9494
return cs.y.scale(d.metric);
9595
});
9696
cs.x.xOffset = cs.y.axisWidth + 5;
97-
cs.x.yOffset = _this.height - cs.x.axisHeight;
97+
cs.x.yOffset = _this.displayHeight - cs.x.axisHeight;
9898
cs.y.xOffset = cs.y.axisWidth;
9999
cs.y.yOffset = 0;
100100
svgContainer.append('g').append('g').attr('class', 'axis').attr('transform', 'translate(' + cs.x.xOffset + ', ' + cs.x.yOffset + ')').call(cs.x.axis);
@@ -106,6 +106,8 @@ var areaChart = function chart() {
106106
enter(poly);
107107
transition(poly);
108108
exit(poly);
109+
110+
return cs;
109111
};
110112

111113
export default areaChart;

dist/module/import/barChart.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ var barChart = function chart() {
4646
* @description Returns height of the bar
4747
*/
4848
var getHeight = function getHeight() {
49-
return (_this.height - cs.x.axisHeight - _this.header - cs.bar.vPadding) / _this.ds.length - 1;
49+
return (_this.displayHeight - cs.x.axisHeight - _this.header - cs.bar.vPadding) / _this.ds.length - 1;
5050
};
5151

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

6262
/**
@@ -113,7 +113,7 @@ var barChart = function chart() {
113113
return cs.y.domain.push(t.dim);
114114
});
115115
_this.ds.forEach(function (t, i) {
116-
return cs.y.range.push((_this.chartData.height - cs.x.axisHeight - _this.header + cs.bar.vPadding) * i / _this.ds.length);
116+
return cs.y.range.push((_this.displayHeight - cs.x.axisHeight - _this.header + cs.bar.vPadding) * i / _this.ds.length);
117117
});
118118
cs.y.scale = d3.scaleOrdinal().domain(cs.y.domain).range(cs.y.range);
119119
};
@@ -124,7 +124,7 @@ var barChart = function chart() {
124124
var drawAxis = function drawAxis() {
125125
cs.x.axis = d3.axisBottom().ticks(cs.x.ticks, 's').scale(cs.x.scale);
126126
cs.y.axis = d3.axisLeft().scale(cs.y.scale);
127-
cs.x.yOffset = _this.height - cs.x.axisHeight;
127+
cs.x.yOffset = _this.displayHeight - cs.x.axisHeight;
128128
cs.x.xOffset = cs.bar.hPadding + cs.y.axisWidth;
129129
cs.y.yOffset = cs.bar.vPadding + _this.header - 1;
130130
cs.y.xOffset = cs.y.axisWidth;
@@ -146,6 +146,8 @@ var barChart = function chart() {
146146
enter(rects);
147147
transition(rects);
148148
exit(rects);
149+
150+
return cs;
149151
};
150152

151153
export default barChart;

dist/module/import/lineGraph.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ var lineGraph = function chart(mode) {
8484
* @description builds the scales for the x and y axes
8585
*/
8686
var buildScales = function buildScales() {
87-
cs.y.scale = d3.scaleLinear().domain([_this.min, _this.max]).range([_this.height - cs.x.axisHeight, _this.header]);
87+
cs.y.scale = d3.scaleLinear().domain([_this.min, _this.max]).range([_this.displayHeight - cs.x.axisHeight, _this.header]);
8888
cs.y.axis = d3.axisLeft().ticks(cs.y.ticks, 's').scale(cs.y.scale);
8989
_this.ds.forEach(function (t) {
9090
return cs.x.domain.push(t.dim);
@@ -101,7 +101,7 @@ var lineGraph = function chart(mode) {
101101
var drawAxis = function drawAxis() {
102102
cs.x.axis = d3.axisBottom().scale(cs.x.scale);
103103
cs.x.xOffset = cs.y.axisWidth + 5;
104-
cs.x.yOffset = _this.height - cs.x.axisHeight;
104+
cs.x.yOffset = _this.displayHeight - cs.x.axisHeight;
105105
cs.y.xOffset = cs.y.axisWidth;
106106
cs.y.yOffset = 0;
107107
};
@@ -128,6 +128,8 @@ var lineGraph = function chart(mode) {
128128

129129
svgContainer.append('g').append('g').attr('class', 'axis').attr('transform', 'translate(' + cs.x.xOffset + ', ' + cs.x.yOffset + ')').call(cs.x.axis);
130130
svgContainer.append('g').append('g').attr('class', 'axis').attr('transform', 'translate(' + cs.y.xOffset + ',' + cs.y.yOffset + ')').call(cs.y.axis);
131+
132+
return cs;
131133
};
132134

133135
export default lineGraph;

dist/module/import/pieChart.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ var pieChart = function chart() {
8686
enter(arc);
8787
transition(arc);
8888
exit(arc);
89+
90+
return cs;
8991
};
9092

9193
export default pieChart;

dist/module/import/scatterPlot.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ var scatterPlot = function chart() {
7272
* @description builds the scales for the x and y axes
7373
*/
7474
var buildScales = function buildScales() {
75-
cs.y.scale = d3.scaleLinear().domain([_this.min, _this.max]).range([_this.height - cs.x.axisHeight, _this.header]);
75+
cs.y.scale = d3.scaleLinear().domain([_this.min, _this.max]).range([_this.displayHeight - cs.x.axisHeight, _this.header]);
7676
cs.y.axis = d3.axisLeft().ticks(cs.y.ticks, 's').scale(cs.y.scale);
7777
_this.ds.forEach(function (t) {
7878
return cs.x.domain.push(t.dim);
@@ -102,6 +102,8 @@ var scatterPlot = function chart() {
102102
enter(points);
103103
transition(points);
104104
exit(points);
105+
106+
return cs;
105107
};
106108

107109
export default scatterPlot;

dist/module/import/vBarChart.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ var vBarChart = function chart() {
4646
* @description Returns height of the bar
4747
*/
4848
var getHeight = function getHeight(d) {
49-
return _this.height - cs.y.scale(d.metric);
49+
return _this.displayHeight - cs.y.scale(d.metric);
5050
};
5151

5252
/**
@@ -114,7 +114,7 @@ var vBarChart = function chart() {
114114
* @description builds the scales for the x and y axes
115115
*/
116116
var buildScales = function buildScales() {
117-
cs.y.scale = d3.scaleLinear().domain([0, _this.max]).range([_this.height, _this.header]);
117+
cs.y.scale = d3.scaleLinear().domain([0, _this.max]).range([_this.displayHeight, _this.header]);
118118
_this.ds.forEach(function (t) {
119119
return cs.x.domain.push(t.dim);
120120
});
@@ -130,7 +130,7 @@ var vBarChart = function chart() {
130130
var drawAxis = function drawAxis() {
131131
cs.y.axis = d3.axisLeft().ticks(cs.y.ticks, 's').scale(cs.y.scale);
132132
cs.x.axis = d3.axisBottom().scale(cs.x.scale);
133-
cs.x.yOffset = _this.height;
133+
cs.x.yOffset = _this.displayHeight;
134134
cs.x.xOffset = cs.y.axisWidth;
135135
cs.y.yOffset = 0;
136136
cs.y.xOffset = cs.y.axisWidth;
@@ -146,6 +146,8 @@ var vBarChart = function chart() {
146146
enter(rects);
147147
transition(rects);
148148
exit(rects);
149+
150+
return cs;
149151
};
150152

151153
export default vBarChart;

dist/module/v-chart-plugin.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ var Chart = {
4141
* @description Generate a new Chart of type chartType
4242
*/
4343
initalizeChart: function initalizeChart() {
44+
var cs = this[this.chartData.chartType]('init');
4445
this.drawTitle();
45-
this.generateLegend();
46-
this[this.chartData.chartType]('init');
46+
this.generateLegend(cs);
4747
},
4848

4949
/**
@@ -141,12 +141,13 @@ var Chart = {
141141
* @method generateLegend
142142
* @description generate legend if option -legends- defined as true
143143
*/
144-
generateLegend: function generateLegend() {
144+
generateLegend: function generateLegend(cs) {
145145
if (this.chartData.legends && this.chartData.legends.enabled === true) {
146-
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);
146+
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);
147147

148-
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 () {
149-
return '#005792';
148+
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 () {
149+
var fill = cs.palette.lineFill || cs.palette.fill;
150+
return fill;
150151
});
151152
}
152153
}
@@ -220,6 +221,19 @@ var Chart = {
220221
return 0;
221222
},
222223

224+
/**
225+
* @method displayHeight
226+
* @description Computed.
227+
* @returns {number} Height of the chart display
228+
*/
229+
displayHeight: function displayHeight() {
230+
if (this.chartData.legends && this.chartData.legends.enabled === true) {
231+
return this.height * .80;
232+
} else {
233+
return this.height;
234+
}
235+
},
236+
223237
/**
224238
* @method subtitleHeight
225239
* @description Computed.

dist/static/js/app.2faf389e8b9bc428e824.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

dist/static/js/app.2faf389e8b9bc428e824.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)