@oliasoft-open-source/charts-library 5.12.0 → 5.12.1

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.d.ts CHANGED
@@ -1194,24 +1194,24 @@ export { }
1194
1194
 
1195
1195
  declare module 'chart.js' {
1196
1196
  interface PluginOptionsByType<TType extends ChartType> {
1197
- annotationDraggerPlugin?: AnnotationDraggerPluginOptions;
1197
+ lineMarkersPlugin?: {
1198
+ enabled?: boolean;
1199
+ } | TLineMarkersOptions;
1198
1200
  }
1199
1201
  }
1200
1202
 
1201
1203
 
1202
1204
  declare module 'chart.js' {
1203
1205
  interface PluginOptionsByType<TType extends ChartType> {
1204
- calloutConnectorPlugin?: {
1205
- enableCalloutAnnotation?: boolean;
1206
- };
1206
+ annotationDraggerPlugin?: AnnotationDraggerPluginOptions;
1207
1207
  }
1208
1208
  }
1209
1209
 
1210
1210
 
1211
1211
  declare module 'chart.js' {
1212
1212
  interface PluginOptionsByType<TType extends ChartType> {
1213
- lineMarkersPlugin?: {
1214
- enabled?: boolean;
1215
- } | TLineMarkersOptions;
1213
+ calloutConnectorPlugin?: {
1214
+ enableCalloutAnnotation?: boolean;
1215
+ };
1216
1216
  }
1217
1217
  }
package/dist/index.js CHANGED
@@ -19473,14 +19473,17 @@ var downloadPgn = (chartRef) => {
19473
19473
  if (!chart) return;
19474
19474
  const canvasElement = chart?.canvas?.parentElement;
19475
19475
  if (!canvasElement) return;
19476
- const { ctx } = chart;
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
- toPng(canvasElement, { skipFonts: navigator.userAgent.includes("Firefox") }).then((dataUrl) => {
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) => {
19484
19487
  triggerBase64Download(dataUrl, fileName);
19485
19488
  }).catch((e) => {
19486
19489
  console.error("Could not parse the html: ", e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/charts-library",
3
- "version": "5.12.0",
3
+ "version": "5.12.1",
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": {