@oliasoft-open-source/charts-library 7.0.0-beta-1 → 7.0.0

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
@@ -1244,18 +1244,18 @@ declare module 'chart.js' {
1244
1244
 
1245
1245
  declare module 'chart.js' {
1246
1246
  interface PluginOptionsByType<TType extends ChartType> {
1247
- lineMarkersPlugin?: {
1248
- enabled?: boolean;
1249
- } | TLineMarkersOptions;
1247
+ calloutConnectorPlugin?: {
1248
+ enableCalloutAnnotation?: boolean;
1249
+ };
1250
1250
  }
1251
1251
  }
1252
1252
 
1253
1253
 
1254
1254
  declare module 'chart.js' {
1255
1255
  interface PluginOptionsByType<TType extends ChartType> {
1256
- calloutConnectorPlugin?: {
1257
- enableCalloutAnnotation?: boolean;
1258
- };
1256
+ lineMarkersPlugin?: {
1257
+ enabled?: boolean;
1258
+ } | TLineMarkersOptions;
1259
1259
  }
1260
1260
  }
1261
1261
 
package/dist/index.js CHANGED
@@ -19847,7 +19847,7 @@ var useToggleHandlers = (dispatch) => {
19847
19847
  };
19848
19848
  };
19849
19849
  //#endregion
19850
- //#region src/components/common/helpers/download-pgn.ts
19850
+ //#region src/components/common/helpers/download-png.ts
19851
19851
  var getAxesLabelsFromChart = (chart) => {
19852
19852
  return Object.entries(chart?.scales).map(([scaleId, scale]) => {
19853
19853
  const axis = scale?.axis;
@@ -19855,7 +19855,7 @@ var getAxesLabelsFromChart = (chart) => {
19855
19855
  return { label: `${axis}-${Array.isArray(rawLabel) ? rawLabel?.join(" ") : rawLabel || scaleId}` };
19856
19856
  });
19857
19857
  };
19858
- var downloadPgn = (chartRef) => {
19858
+ var downloadPng = (chartRef) => {
19859
19859
  const chart = chartRef.current;
19860
19860
  if (!chart) return;
19861
19861
  const canvasElement = chart?.canvas?.parentElement;
@@ -19963,7 +19963,7 @@ var useChartFunctions = ({ chartRef, state, options, dispatch }) => {
19963
19963
  /**
19964
19964
  * Handles the download of the chart as an image
19965
19965
  */
19966
- const handleDownload = useCallback(() => downloadPgn(chartRef), [chartRef]);
19966
+ const handleDownload = useCallback(() => downloadPng(chartRef), [chartRef]);
19967
19967
  /**
19968
19968
  * Handles the key down event for the chart
19969
19969
  */
@@ -24596,6 +24596,9 @@ Chart$1.register(LinearScale, PointElement, LineElement, CategoryScale, Logarith
24596
24596
  var LineChart = (props) => {
24597
24597
  setDefaultTheme();
24598
24598
  const chartRef = useRef(null);
24599
+ const setChartRef = useCallback((chartInstance) => {
24600
+ chartRef.current = chartInstance ?? null;
24601
+ }, []);
24599
24602
  const { table, headerComponent, subheaderComponent } = props ?? {};
24600
24603
  const { translations, languageKey } = getConfig();
24601
24604
  const { data: { datasets } = { datasets: [] }, options, testId, persistenceId, controlsPortalId } = getDefaultProps$3(props);
@@ -24666,7 +24669,7 @@ var LineChart = (props) => {
24666
24669
  className: line_chart_module_default.canvas,
24667
24670
  id: "canvas",
24668
24671
  children: [/* @__PURE__ */ jsx(Line, {
24669
- ref: chartRef,
24672
+ ref: setChartRef,
24670
24673
  data: { datasets: generatedDatasets },
24671
24674
  options: useOptions,
24672
24675
  plugins: usePlugins
@@ -39268,6 +39271,9 @@ Chart$1.register(LinearScale, PointElement, LineElement, CategoryScale, Logarith
39268
39271
  var BarChart = (props) => {
39269
39272
  setDefaultTheme();
39270
39273
  const chartRef = useRef(null);
39274
+ const setChartRef = useCallback((chartInstance) => {
39275
+ chartRef.current = chartInstance ?? null;
39276
+ }, []);
39271
39277
  const chart = getDefaultProps$1(props);
39272
39278
  const { translations, languageKey } = getConfig();
39273
39279
  const { options, testId, controlsPortalId } = chart;
@@ -39298,7 +39304,7 @@ var BarChart = (props) => {
39298
39304
  colored: "muted",
39299
39305
  round: true,
39300
39306
  icon: "download",
39301
- onClick: () => downloadPgn(chartRef)
39307
+ onClick: () => downloadPng(chartRef)
39302
39308
  })
39303
39309
  })
39304
39310
  })
@@ -39309,7 +39315,7 @@ var BarChart = (props) => {
39309
39315
  className: bar_chart_module_default.canvas,
39310
39316
  id: "canvas",
39311
39317
  children: [/* @__PURE__ */ jsx(Bar, {
39312
- ref: chartRef,
39318
+ ref: setChartRef,
39313
39319
  data: {
39314
39320
  labels: chart?.data?.labels?.length ? chart.data.labels : [""],
39315
39321
  datasets: generatedDatasets
@@ -39690,6 +39696,9 @@ Chart$1.register(LinearScale, PointElement, CategoryScale, TimeScale, TimeSeries
39690
39696
  var ScatterChart = (props) => {
39691
39697
  setDefaultTheme();
39692
39698
  const chartRef = useRef(null);
39699
+ const setChartRef = useCallback((chartInstance) => {
39700
+ chartRef.current = chartInstance ?? null;
39701
+ }, []);
39693
39702
  const chart = getDefaultProps(props);
39694
39703
  const { options, testId } = chart;
39695
39704
  const { scatterOptions, generatedDatasets } = useScatterChartConfig(chart, chartRef);
@@ -39707,7 +39716,7 @@ var ScatterChart = (props) => {
39707
39716
  className: scatter_chart_module_default.canvas,
39708
39717
  id: "canvas",
39709
39718
  children: [/* @__PURE__ */ jsx(Scatter, {
39710
- ref: chartRef,
39719
+ ref: setChartRef,
39711
39720
  data: { datasets: generatedDatasets },
39712
39721
  options: scatterOptions,
39713
39722
  plugins: getPlugins(options.graph, options.legend)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/charts-library",
3
- "version": "7.0.0-beta-1",
3
+ "version": "7.0.0",
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": {