Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Giehl <stefan@piwik.org>2017-03-29 21:45:17 +0300
committerMatthieu Aubry <mattab@users.noreply.github.com>2017-03-29 21:45:17 +0300
commit9c86cd6f9cbcb8c0bbb2825f725658f2b6b1fc3f (patch)
tree1ba3998387e8f1ecd3117e2cac47654c9dcbdfbe /plugins/CoreVisualizations
parentd578a737916f64e777c37ce8a427591c5c9e2414 (diff)
fix scaling of exported images (#11557)
Diffstat (limited to 'plugins/CoreVisualizations')
-rw-r--r--plugins/CoreVisualizations/javascripts/jqplot.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/plugins/CoreVisualizations/javascripts/jqplot.js b/plugins/CoreVisualizations/javascripts/jqplot.js
index 13c91a568c..984f8b4484 100644
--- a/plugins/CoreVisualizations/javascripts/jqplot.js
+++ b/plugins/CoreVisualizations/javascripts/jqplot.js
@@ -407,9 +407,10 @@
/** Export the chart as an image */
exportAsImage: function (container, lang) {
+ var pixelRatio = window.devicePixelRatio || 1;
var exportCanvas = document.createElement('canvas');
- exportCanvas.width = container.width();
- exportCanvas.height = container.height();
+ exportCanvas.width = Math.round(container.width() * pixelRatio);
+ exportCanvas.height = Math.round(container.height() * pixelRatio);
if (!exportCanvas.getContext) {
alert("Sorry, not supported in your browser. Please upgrade your browser :)");
@@ -428,7 +429,7 @@
position.left += addPosition.left;
position.top += addPosition.top + parseInt(parent.css('marginTop'), 10);
}
- exportCtx.drawImage(canvas[0], Math.round(position.left), Math.round(position.top));
+ exportCtx.drawImage(canvas[0], Math.round(position.left * pixelRatio), Math.round(position.top * pixelRatio));
}
var exported = exportCanvas.toDataURL("image/png");
@@ -437,8 +438,8 @@
img.src = exported;
img = $(img).css({
- width: exportCanvas.width + 'px',
- height: exportCanvas.height + 'px'
+ width: Math.round(exportCanvas.width / pixelRatio) + 'px',
+ height: Math.round(exportCanvas.height / pixelRatio) + 'px'
});
var popover = $(document.createElement('div'));