Commit 19ca1daa authored by Mahdi Mahmoudy's avatar Mahdi Mahmoudy
Browse files

resolve conflict and small improvement

parents 1183b853 a15a31be
......@@ -12,7 +12,7 @@
<label>
<input type="checkbox" ng-model="$parent.showIds"> Show Ids
</label>
<label>Multiply chart size
<label>Chart size
<select
ng-options="item as item.name for item in multiplyChartSizeItems"
ng-model="multiplyChartSizeSelected"
......@@ -36,6 +36,7 @@
<input type="checkbox" ng-model="$parent.showChildren"> Show children
</label>
<a class="button small" ng-click="applyOptions();$close()">Apply</a>
<a class="button small" ng-click="downloadChart();$close()">Download Chart</a>
</pane>
</dropdown-toggle>
</div>
......
......@@ -12,28 +12,28 @@ angular
link: function(scope) {
scope.showKey = true;
scope.showIds = true;
scope.termBoxWidth = 85;
scope.termBoxHeight = 55;
scope.fontSize = 11;
scope.originalTermBoxWidth = 85;
scope.originalTermBoxHeight = 55;
scope.originalFontSize = 11;
scope.termBoxWidth = scope.originalTermBoxWidth;
scope.termBoxHeight = scope.originalTermBoxHeight;
scope.fontSize = scope.originalFontSize;
scope.showSlimColours = false;
scope.showChildren = false;
var that = this;
scope.applyOptions = function() {
scope.originalChartSizeValues = null;
that.drawChart(scope);
};
scope.multiplyChartSizeItems = [
{ name: "Do not multiply", value: 1 },
{ name: "Multiply by 2", value: 2 },
{ name: "Multiply by 3", value: 3 },
{ name: "Multiply by 4", value: 4 },
{ name: "Default - normal", value: 1 },
{ name: "2X - double", value: 2 },
{ name: "3X - triple", value: 3 },
{ name: "4x - quadruple", value: 4 },
];
scope.originalChartSizeValues = null;
scope.multiplyChartSize = function(selectedItem) {
var size = selectedItem.value;
......@@ -41,23 +41,38 @@ angular
return;
}
if (!scope.originalChartSizeValues) {
scope.originalChartSizeValues = {
width: scope.termBoxWidth,
height: scope.termBoxHeight,
font: scope.fontSize,
};
scope.termBoxWidth = scope.originalTermBoxWidth * size;
scope.termBoxHeight = scope.originalTermBoxHeight * size;
scope.fontSize = scope.originalFontSize * size;
}
scope.downloadChart = function() {
if (!scope.termBoxHeight) {
return;
}
if (size === 1) {
scope.termBoxWidth = scope.originalChartSizeValues.width;
scope.termBoxHeight = scope.originalChartSizeValues.height;
scope.fontSize = scope.originalChartSizeValues.font;
if (!scope.termBoxWidth) {
return;
}
scope.termBoxWidth = scope.originalChartSizeValues.width * size;
scope.termBoxHeight = scope.originalChartSizeValues.height * size;
scope.fontSize = scope.originalChartSizeValues.font * size;
// Requesting a larger chart from the service
var chartPromise = chartService.getChart(
scope.ids,
scope.showIds,
scope.showKey,
Math.round(scope.termBoxWidth * 2.5),
Math.round(scope.termBoxHeight * 2.5),
Math.round(scope.fontSize * 2.5),
scope.showSlimColours,
scope.showChildren
);
chartPromise.then(function(d) {
var a = document.createElement("a");
a.href = "data:image/png;base64," + d.data;
a.download = scope.title + ".png";
a.click();
});
}
this.drawChart(scope);
......
......@@ -10117,9 +10117,9 @@
}
},
"natives": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/natives/-/natives-1.1.1.tgz",
"integrity": "sha512-8eRaxn8u/4wN8tGkhlc2cgwwvOLMLUMUn4IYTexMgWd+LyUDfeXVkk2ygQR0hvIHbJQXgHujia3ieUUDwNGkEA==",
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/natives/-/natives-1.1.6.tgz",
"integrity": "sha512-6+TDFewD4yxY14ptjKaS63GVdtKiES1pTPyxn9Jb0rBqPMZ7VcCiooEhPNsr+mqHtMGxa/5c/HhcC4uPEUw/nA==",
"dev": true
},
"natural-compare": {
......
......@@ -56,7 +56,8 @@
"karma-phantomjs-launcher": "^1.0.0",
"karma-spec-reporter": "0.0.24",
"phantomjs-prebuilt": "^2.1.4",
"time-grunt": "^1.0.0"
"time-grunt": "^1.0.0",
"natives": "^1.1.6"
},
"engines": {
"node": ">=0.10.0"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment