@oliasoft-open-source/charts-library 5.11.1-beta-1 → 5.11.1-beta-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +14 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19473,21 +19473,21 @@ var downloadPgn = (chartRef) => {
|
|
|
19473
19473
|
if (!chart) return;
|
|
19474
19474
|
const canvasElement = chart?.canvas?.parentElement;
|
|
19475
19475
|
if (!canvasElement) return;
|
|
19476
|
-
const
|
|
19477
|
-
ctx.save();
|
|
19478
|
-
ctx.globalCompositeOperation = "destination-over";
|
|
19479
|
-
ctx.fillStyle = document.body.dataset.theme === "dark" ? "black" : "white";
|
|
19480
|
-
ctx.fillRect(0, 0, chart.width, chart.height);
|
|
19481
|
-
ctx.restore();
|
|
19476
|
+
const isDark = document.body.dataset.theme === "dark";
|
|
19482
19477
|
const fileName = getChartFileName(getAxesLabelsFromChart(chart));
|
|
19483
|
-
const toPngOptions = {
|
|
19484
|
-
|
|
19485
|
-
|
|
19486
|
-
|
|
19487
|
-
|
|
19488
|
-
|
|
19489
|
-
|
|
19490
|
-
}
|
|
19478
|
+
const toPngOptions = {
|
|
19479
|
+
skipFonts: navigator.userAgent.includes("Firefox"),
|
|
19480
|
+
backgroundColor: isDark ? "black" : "white"
|
|
19481
|
+
};
|
|
19482
|
+
const captureSnapshot = async (previousDataUrl, options) => {
|
|
19483
|
+
const dataUrl = await toPng(canvasElement, toPngOptions);
|
|
19484
|
+
return dataUrl.length !== previousDataUrl.length ? captureSnapshot(dataUrl, options) : dataUrl;
|
|
19485
|
+
};
|
|
19486
|
+
captureSnapshot("", toPngOptions).then((dataUrl) => {
|
|
19487
|
+
triggerBase64Download(dataUrl, fileName);
|
|
19488
|
+
}).catch((e) => {
|
|
19489
|
+
console.error("Could not parse the html: ", e);
|
|
19490
|
+
});
|
|
19491
19491
|
};
|
|
19492
19492
|
//#endregion
|
|
19493
19493
|
//#region src/components/line-chart/utils/line-chart-utils.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oliasoft-open-source/charts-library",
|
|
3
|
-
"version": "5.11.1-beta-
|
|
3
|
+
"version": "5.11.1-beta-2",
|
|
4
4
|
"description": "React Chart Library (based on Chart.js and react-chart-js-2)",
|
|
5
5
|
"homepage": "https://gitlab.com/oliasoft-open-source/charts-library",
|
|
6
6
|
"bugs": {
|