pace-chart-lib 1.0.63 → 1.0.65

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.
@@ -9,6 +9,7 @@ interface ICJSAreaChartProps {
9
9
  isChartStacked?: boolean;
10
10
  /** Active theme colour bank from the host application. Falls back to default palette. */
11
11
  colorBank?: string[];
12
+ addLocalFilterFromLib?: (clickedLegendData: any) => void;
12
13
  }
13
14
  /**
14
15
  * Chart.js area chart.
@@ -7,6 +7,7 @@ interface ICJSBubbleChartProps {
7
7
  clientHeight: number;
8
8
  /** Active theme colour bank from the host application. Falls back to default palette. */
9
9
  colorBank?: string[];
10
+ addLocalFilterFromLib?: (clickedLegendData: any) => void;
10
11
  }
11
12
  /**
12
13
  * Chart.js bubble chart.
@@ -9,6 +9,7 @@ interface ICJSColumnChartProps {
9
9
  isChartStacked?: boolean;
10
10
  /** Active theme colour bank from the host application. Falls back to default palette. */
11
11
  colorBank?: string[];
12
+ addLocalFilterFromLib?: (clickedLegendData: any) => void;
12
13
  }
13
14
  /**
14
15
  * Chart.js vertical bar chart.
@@ -7,6 +7,7 @@ interface ICJSDonutChartProps {
7
7
  clientHeight: number;
8
8
  /** Active theme colour bank from the host application. Falls back to default palette. */
9
9
  colorBank?: string[];
10
+ addLocalFilterFromLib?: (clickedLegendData: any) => void;
10
11
  }
11
12
  /**
12
13
  * Chart.js doughnut (donut) chart.
@@ -8,6 +8,7 @@ interface ICJSHorizontalBarChartProps {
8
8
  isChartStacked?: boolean;
9
9
  /** Active theme colour bank from the host application. Falls back to default palette. */
10
10
  colorBank?: string[];
11
+ addLocalFilterFromLib?: (clickedLegendData: any) => void;
11
12
  }
12
13
  /**
13
14
  * Chart.js horizontal bar chart.
@@ -9,6 +9,7 @@ interface ICJSLineChartProps {
9
9
  isChartStacked?: boolean;
10
10
  /** Active theme colour bank from the host application. Falls back to default palette. */
11
11
  colorBank?: string[];
12
+ addLocalFilterFromLib?: (clickedLegendData: any) => void;
12
13
  }
13
14
  /**
14
15
  * Chart.js line chart.
@@ -6,6 +6,7 @@ interface ICJSNormalizedStackAreaChartProps {
6
6
  clientWidth?: number;
7
7
  clientHeight?: number;
8
8
  colorBank?: string[];
9
+ addLocalFilterFromLib?: (clickedLegendData: any) => void;
9
10
  }
10
11
  /**
11
12
  * Chart.js 100% normalized stacked area chart.
@@ -6,6 +6,7 @@ interface ICJSNormalizedStackColumnChartProps {
6
6
  clientWidth?: number;
7
7
  clientHeight?: number;
8
8
  colorBank?: string[];
9
+ addLocalFilterFromLib?: (clickedLegendData: any) => void;
9
10
  }
10
11
  /**
11
12
  * Chart.js 100% normalized stacked vertical bar chart.
@@ -6,6 +6,7 @@ interface ICJSNormalizedStackHorizontalBarChartProps {
6
6
  clientWidth?: number;
7
7
  clientHeight?: number;
8
8
  colorBank?: string[];
9
+ addLocalFilterFromLib?: (clickedLegendData: any) => void;
9
10
  }
10
11
  /**
11
12
  * Chart.js 100% normalized stacked horizontal bar chart.
@@ -6,6 +6,7 @@ interface ICJSNormalizedStackLineChartProps {
6
6
  clientWidth?: number;
7
7
  clientHeight?: number;
8
8
  colorBank?: string[];
9
+ addLocalFilterFromLib?: (clickedLegendData: any) => void;
9
10
  }
10
11
  /**
11
12
  * Chart.js 100% normalized stacked line chart.
@@ -7,6 +7,7 @@ interface ICJSPieChartProps {
7
7
  clientHeight: number;
8
8
  /** Active theme colour bank from the host application. Falls back to default palette. */
9
9
  colorBank?: string[];
10
+ addLocalFilterFromLib?: (clickedLegendData: any) => void;
10
11
  }
11
12
  /**
12
13
  * Chart.js pie chart.
@@ -7,6 +7,7 @@ interface ICJSPolarAreaChartProps {
7
7
  clientHeight: number;
8
8
  /** Active theme colour bank from the host application. Falls back to default palette. */
9
9
  colorBank?: string[];
10
+ addLocalFilterFromLib?: (clickedLegendData: any) => void;
10
11
  }
11
12
  /**
12
13
  * Chart.js polar area chart.
@@ -6,4 +6,4 @@ import type { TCJSChartType } from "./ChartJSDataTransformer";
6
6
  * All colours, fonts, and visibility flags are derived from formatOptions so the
7
7
  * CJS charts match the styling configured in the host application's right pane.
8
8
  */
9
- export declare function mapFormatOptionsToChartJS(formatOptions: TDefaultChartFormatOptionsType, chartType: TCJSChartType, hasSecondaryAxis?: boolean): ChartOptions;
9
+ export declare function mapFormatOptionsToChartJS(formatOptions: TDefaultChartFormatOptionsType, chartType: TCJSChartType, hasSecondaryAxis?: boolean, addLocalFilterFromLib?: (clickedLegendData: any) => void, legendList?: any[]): ChartOptions;
@@ -11261,7 +11261,7 @@ const defaultChartFormatOptions = {
11261
11261
  dataLabelsCoordinates: [],
11262
11262
  hideInsignificantValue: false,
11263
11263
  sortBy: "default",
11264
- chartDirection: "top",
11264
+ chartDirection: "right",
11265
11265
  plotAreaRangeFilter: {
11266
11266
  enabled: false,
11267
11267
  condition: "lt",
@@ -54272,6 +54272,12 @@ const OrganizationChart = ({
54272
54272
  let chartData = [];
54273
54273
  let scrollWidth = 0;
54274
54274
  let scrollHeight = 0;
54275
+ let legendListWidth;
54276
+ let displayedLegends = /* @__PURE__ */ new Map();
54277
+ let maxLegendDimensions;
54278
+ let maxMeasure = Number.NEGATIVE_INFINITY;
54279
+ let minMeasure = Number.POSITIVE_INFINITY;
54280
+ let heatMapScale;
54275
54281
  useEffect(() => {
54276
54282
  drawChart();
54277
54283
  }, [chartId, data, formatOptions]);
@@ -54280,16 +54286,60 @@ const OrganizationChart = ({
54280
54286
  svgRef,
54281
54287
  formatOptions
54282
54288
  ));
54283
- ({ margins, chartTitleHeight, innerHeight, innerWidth } = marginCalculationsForChartsWithoutLegends(
54289
+ dataPreparation();
54290
+ maxLegendDimensions = calculateLegendsMaxPossibleWidth2(displayedLegends);
54291
+ ({ margins, innerHeight, innerWidth, legendListWidth, chartTitleHeight } = marginCalculationsForChartsWithoutAxis(
54284
54292
  chartFormatOptions,
54293
+ width,
54285
54294
  height,
54286
- width
54295
+ maxLegendDimensions,
54296
+ margins
54287
54297
  ));
54288
54298
  initSvg(svgRef, width, height, chartFormatOptions);
54289
54299
  drawChartTitle(svgRef, chartTitleHeight, width, chartFormatOptions);
54290
- dataPreparation();
54291
54300
  scrollWidthHeightCalculation();
54292
54301
  drawOrganizationChart(chartData);
54302
+ initLegendListForOrganizationChart();
54303
+ };
54304
+ const calculateLegendsMaxPossibleWidth2 = (displayedLegendsMap) => {
54305
+ const legends = [];
54306
+ displayedLegendsMap.forEach((_value, key) => {
54307
+ legends.push(key);
54308
+ });
54309
+ const longestLegend = legends.reduce((a2, b) => a2.length > b.length ? a2 : b, "");
54310
+ const legendDims = preCalculateTextDimensions(
54311
+ longestLegend,
54312
+ convertStringToNumber(chartFormatOptions.legends.legendFontSize),
54313
+ chartFormatOptions.legends.legendFontFamily
54314
+ );
54315
+ return [legendDims.width, legendDims.height];
54316
+ };
54317
+ const initLegendListForOrganizationChart = () => {
54318
+ let seriesData = [];
54319
+ displayedLegends.forEach((colors2, label) => {
54320
+ const color2 = `linear-gradient(90deg, ${colors2.join(", ")})`;
54321
+ seriesData.push({
54322
+ properties: {
54323
+ ...legendEntries[0],
54324
+ name: label,
54325
+ alias: label,
54326
+ color: color2
54327
+ }
54328
+ });
54329
+ });
54330
+ initLegendListWithTotalValueAllowance(
54331
+ chartFormatOptions,
54332
+ svg,
54333
+ seriesData,
54334
+ width,
54335
+ height,
54336
+ legendListWidth,
54337
+ chartTitleHeight,
54338
+ chartId,
54339
+ margins,
54340
+ staticLegendShape.rectangle,
54341
+ void 0
54342
+ );
54293
54343
  };
54294
54344
  const dataPreparation = () => {
54295
54345
  try {
@@ -54306,6 +54356,11 @@ const OrganizationChart = ({
54306
54356
  createIdIndexMap(tempData);
54307
54357
  generateUID(tempData);
54308
54358
  chartData = addStyleObjectToChartData(tempData);
54359
+ if (chartFormatOptions.heatMap.showHeatMap) {
54360
+ heatMapScale = sequential().domain([minMeasure, maxMeasure]).interpolator(
54361
+ interpolateRgb$1(chartFormatOptions.heatMap.heatMapMaxColor, chartFormatOptions.heatMap.heatMapMinColor)
54362
+ );
54363
+ }
54309
54364
  } catch (error) {
54310
54365
  logError$2(fileName$1, "dataPreparation", error);
54311
54366
  }
@@ -54362,11 +54417,22 @@ const OrganizationChart = ({
54362
54417
  indexMapForStyleObject.set(styleObject.name, styleObject);
54363
54418
  });
54364
54419
  Object.keys(data2).forEach((key) => {
54365
- const legendObject = indexMapForStyleObject.get(data2[key].UID ?? data2[key].nodeLabel);
54420
+ const nodeObj = data2[key];
54421
+ const legendObject = indexMapForStyleObject.get(nodeObj.UID ?? nodeObj.nodeLabel) ?? legendEntries[0];
54366
54422
  data2[key] = {
54367
- ...data2[key],
54368
- styleObject: legendObject || legendEntries[0]
54423
+ ...nodeObj,
54424
+ styleObject: legendObject
54369
54425
  };
54426
+ if (nodeObj.label) {
54427
+ if (displayedLegends.has(nodeObj.label)) {
54428
+ const colors2 = displayedLegends.get(nodeObj.label);
54429
+ displayedLegends.set(nodeObj.label, [...colors2, legendObject.color ?? "#eedddd"]);
54430
+ } else {
54431
+ displayedLegends.set(nodeObj.label, [legendObject.color ?? "#eedddd"]);
54432
+ }
54433
+ }
54434
+ maxMeasure = Math.max(maxMeasure, nodeObj.value);
54435
+ minMeasure = Math.min(minMeasure, nodeObj.value);
54370
54436
  });
54371
54437
  return data2;
54372
54438
  } catch (error) {
@@ -54407,6 +54473,7 @@ const OrganizationChart = ({
54407
54473
  let connectorVisibility = parseInt(
54408
54474
  chartFormatOptions.connector.connectorLineThickness
54409
54475
  );
54476
+ select$2(floatingSvgRef.current).selectAll("*").remove();
54410
54477
  let organizationalChart = new OrgChart();
54411
54478
  organizationalChart.container(`#floating-${chartId}`).svgWidth(scrollWidth).svgHeight(scrollHeight).nodeHeight((d) => calculateNodeHeight(d)).nodeWidth((d) => calculateNodeWidth(d, true)).layout(chartDirection).diagonal((s2, t, m, offsets = { sy: 0 }) => {
54412
54479
  if (chartDirection == "top" || chartDirection == "bottom" || !chartDirection) {
@@ -54580,7 +54647,7 @@ const OrganizationChart = ({
54580
54647
  justify-content: center;
54581
54648
  align-items: center;
54582
54649
  text-align: center;
54583
- background-color: ${d.data.styleObject.color ? d.data.styleObject.color : d.data.styleObject.backgroundColor};
54650
+ background-color: ${chartFormatOptions.heatMap.showHeatMap ? heatMapScale(d.data.value) : chartFormatOptions.nodes.nodesSingleColor ? chartFormatOptions.nodes.nodesColor : d.data.styleObject.color};
54584
54651
  z-index: 99;
54585
54652
  transform: ${transform};
54586
54653
  transition: unset;">
@@ -58123,9 +58190,14 @@ function formatValueForAxis(value2, displayUnits, decimalPrecision) {
58123
58190
  if (displayUnits === "Billions") return (value2 / 1e9).toFixed(precision) + "B";
58124
58191
  return value2.toFixed(precision);
58125
58192
  }
58126
- function mapFormatOptionsToChartJS(formatOptions, chartType, hasSecondaryAxis = false) {
58193
+ function findLegendFromAlias(legendList, alias) {
58194
+ return legendList.find((d) => d.alias == alias);
58195
+ }
58196
+ function mapFormatOptionsToChartJS(formatOptions, chartType, hasSecondaryAxis = false, addLocalFilterFromLib, legendList) {
58127
58197
  const isCircular = chartType === "pie" || chartType === "doughnut" || chartType === "polarArea";
58128
58198
  const isHorizontal = chartType === "horizontalBar";
58199
+ let lastClickTime = 0;
58200
+ const DOUBLE_CLICK_DELAY = 300;
58129
58201
  const gridColor = formatOptions.plotArea?.gridLinesColor ?? "#e0e0e0";
58130
58202
  const legendLabelColor = formatOptions.legends?.legendFontColor ?? "#333333";
58131
58203
  const opts = {
@@ -58150,6 +58222,21 @@ function mapFormatOptionsToChartJS(formatOptions, chartType, hasSecondaryAxis =
58150
58222
  usePointStyle: false,
58151
58223
  boxWidth: 12,
58152
58224
  padding: 16
58225
+ },
58226
+ onClick: function(e, legendItem, legend) {
58227
+ if (addLocalFilterFromLib) {
58228
+ const currentTime = (/* @__PURE__ */ new Date()).getTime();
58229
+ const timeDiff = currentTime - lastClickTime;
58230
+ if (timeDiff < DOUBLE_CLICK_DELAY) {
58231
+ const actualLegend = findLegendFromAlias(legendList, legendItem.text);
58232
+ if (actualLegend) {
58233
+ addLocalFilterFromLib(actualLegend);
58234
+ }
58235
+ lastClickTime = 0;
58236
+ } else {
58237
+ lastClickTime = currentTime;
58238
+ }
58239
+ }
58153
58240
  }
58154
58241
  },
58155
58242
  // ---- Tooltip ----
@@ -73551,9 +73638,14 @@ const CJSColumnChart = ({
73551
73638
  clientWidth = 0,
73552
73639
  clientHeight = 0,
73553
73640
  isChartStacked,
73554
- colorBank
73641
+ colorBank,
73555
73642
  //= CJS_DEFAULT_COLORS,
73643
+ addLocalFilterFromLib
73556
73644
  }) => {
73645
+ const legendList = useMemo(
73646
+ () => data.ChartData?.map((s2) => s2.properties),
73647
+ [data]
73648
+ );
73557
73649
  const hasSecondaryAxis = useMemo(
73558
73650
  () => data.ChartData?.some((s2) => s2.Axis === "Secondary" || s2.properties?.axis === "Secondary"),
73559
73651
  [data]
@@ -73563,7 +73655,7 @@ const CJSColumnChart = ({
73563
73655
  [data, formatOptions, colorBank]
73564
73656
  );
73565
73657
  const chartOptions = useMemo(() => {
73566
- const opts = mapFormatOptionsToChartJS(formatOptions, "bar", hasSecondaryAxis);
73658
+ const opts = mapFormatOptionsToChartJS(formatOptions, "bar", hasSecondaryAxis, addLocalFilterFromLib, legendList);
73567
73659
  if (isChartStacked) {
73568
73660
  opts.scales ??= {};
73569
73661
  opts.scales.x ??= {};
@@ -73592,8 +73684,13 @@ const CJSHorizontalBarChart = ({
73592
73684
  clientWidth = 0,
73593
73685
  clientHeight = 0,
73594
73686
  isChartStacked,
73595
- colorBank = CJS_DEFAULT_COLORS
73687
+ colorBank = CJS_DEFAULT_COLORS,
73688
+ addLocalFilterFromLib
73596
73689
  }) => {
73690
+ const legendList = useMemo(
73691
+ () => data.ChartData?.map((s2) => s2.properties),
73692
+ [data]
73693
+ );
73597
73694
  const hasSecondaryAxis = useMemo(
73598
73695
  () => data.ChartData?.some((s2) => s2.Axis === "Secondary" || s2.properties?.axis === "Secondary"),
73599
73696
  [data]
@@ -73603,7 +73700,7 @@ const CJSHorizontalBarChart = ({
73603
73700
  [data, formatOptions, colorBank]
73604
73701
  );
73605
73702
  const chartOptions = useMemo(() => {
73606
- const opts = mapFormatOptionsToChartJS(formatOptions, "horizontalBar", hasSecondaryAxis);
73703
+ const opts = mapFormatOptionsToChartJS(formatOptions, "horizontalBar", hasSecondaryAxis, addLocalFilterFromLib, legendList);
73607
73704
  opts.indexAxis = "y";
73608
73705
  if (isChartStacked) {
73609
73706
  opts.scales ??= {};
@@ -73633,8 +73730,13 @@ const CJSLineChart = ({
73633
73730
  clientWidth = 0,
73634
73731
  clientHeight = 0,
73635
73732
  isChartStacked,
73636
- colorBank = CJS_DEFAULT_COLORS
73733
+ colorBank = CJS_DEFAULT_COLORS,
73734
+ addLocalFilterFromLib
73637
73735
  }) => {
73736
+ const legendList = useMemo(
73737
+ () => data.ChartData?.map((s2) => s2.properties),
73738
+ [data]
73739
+ );
73638
73740
  const hasSecondaryAxis = useMemo(
73639
73741
  () => data.ChartData?.some((s2) => s2.Axis === "Secondary" || s2.properties?.axis === "Secondary"),
73640
73742
  [data]
@@ -73644,7 +73746,7 @@ const CJSLineChart = ({
73644
73746
  [data, formatOptions, colorBank]
73645
73747
  );
73646
73748
  const chartOptions = useMemo(() => {
73647
- const opts = mapFormatOptionsToChartJS(formatOptions, "line", hasSecondaryAxis);
73749
+ const opts = mapFormatOptionsToChartJS(formatOptions, "line", hasSecondaryAxis, addLocalFilterFromLib, legendList);
73648
73750
  if (isChartStacked) {
73649
73751
  opts.scales ??= {};
73650
73752
  opts.scales.y ??= {};
@@ -73671,8 +73773,13 @@ const CJSAreaChart = ({
73671
73773
  clientWidth = 0,
73672
73774
  clientHeight = 0,
73673
73775
  isChartStacked,
73674
- colorBank = CJS_DEFAULT_COLORS
73776
+ colorBank,
73777
+ addLocalFilterFromLib
73675
73778
  }) => {
73779
+ const legendList = useMemo(
73780
+ () => data.ChartData?.map((s2) => s2.properties),
73781
+ [data]
73782
+ );
73676
73783
  const hasSecondaryAxis = useMemo(
73677
73784
  () => data.ChartData?.some((s2) => s2.Axis === "Secondary" || s2.properties?.axis === "Secondary"),
73678
73785
  [data]
@@ -73682,7 +73789,7 @@ const CJSAreaChart = ({
73682
73789
  [data, formatOptions, colorBank]
73683
73790
  );
73684
73791
  const chartOptions = useMemo(() => {
73685
- const opts = mapFormatOptionsToChartJS(formatOptions, "area", hasSecondaryAxis);
73792
+ const opts = mapFormatOptionsToChartJS(formatOptions, "area", hasSecondaryAxis, addLocalFilterFromLib, legendList);
73686
73793
  if (isChartStacked) {
73687
73794
  opts.scales ??= {};
73688
73795
  opts.scales.y ??= {};
@@ -73708,14 +73815,19 @@ const CJSPieChart = ({
73708
73815
  formatOptions,
73709
73816
  clientWidth,
73710
73817
  clientHeight,
73711
- colorBank
73818
+ colorBank,
73819
+ addLocalFilterFromLib
73712
73820
  }) => {
73821
+ const legendList = useMemo(
73822
+ () => data.LegendList ?? [],
73823
+ [data]
73824
+ );
73713
73825
  const chartData = useMemo(
73714
73826
  () => transformToChartJSData(data, "pie", formatOptions, colorBank),
73715
73827
  [data, formatOptions, colorBank]
73716
73828
  );
73717
73829
  const chartOptions = useMemo(
73718
- () => mapFormatOptionsToChartJS(formatOptions, "pie", false),
73830
+ () => mapFormatOptionsToChartJS(formatOptions, "pie", false, addLocalFilterFromLib, legendList),
73719
73831
  [formatOptions]
73720
73832
  );
73721
73833
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -73735,14 +73847,19 @@ const CJSDonutChart = ({
73735
73847
  formatOptions,
73736
73848
  clientWidth,
73737
73849
  clientHeight,
73738
- colorBank = CJS_DEFAULT_COLORS
73850
+ colorBank = CJS_DEFAULT_COLORS,
73851
+ addLocalFilterFromLib
73739
73852
  }) => {
73853
+ const legendList = useMemo(
73854
+ () => data.LegendList ?? [],
73855
+ [data]
73856
+ );
73740
73857
  const chartData = useMemo(
73741
73858
  () => transformToChartJSData(data, "doughnut", formatOptions, colorBank),
73742
73859
  [data, formatOptions, colorBank]
73743
73860
  );
73744
73861
  const chartOptions = useMemo(() => {
73745
- const base = mapFormatOptionsToChartJS(formatOptions, "doughnut", false);
73862
+ const base = mapFormatOptionsToChartJS(formatOptions, "doughnut", false, addLocalFilterFromLib, legendList);
73746
73863
  const rawInner = formatOptions.plotArea?.innerRadius;
73747
73864
  if (rawInner !== void 0 && rawInner !== null) {
73748
73865
  base.cutout = `${rawInner}%`;
@@ -73793,14 +73910,19 @@ const CJSBubbleChart = ({
73793
73910
  formatOptions,
73794
73911
  clientWidth,
73795
73912
  clientHeight,
73796
- colorBank = CJS_DEFAULT_COLORS
73913
+ colorBank = CJS_DEFAULT_COLORS,
73914
+ addLocalFilterFromLib
73797
73915
  }) => {
73916
+ const legendList = useMemo(
73917
+ () => data.ChartData?.map((s2) => s2.properties),
73918
+ [data]
73919
+ );
73798
73920
  const chartData = useMemo(
73799
73921
  () => transformToChartJSData(data, "bubble", formatOptions, colorBank),
73800
73922
  [data, formatOptions, colorBank]
73801
73923
  );
73802
73924
  const chartOptions = useMemo(
73803
- () => mapFormatOptionsToChartJS(formatOptions, "bubble", false),
73925
+ () => mapFormatOptionsToChartJS(formatOptions, "bubble", false, addLocalFilterFromLib, legendList),
73804
73926
  [formatOptions]
73805
73927
  );
73806
73928
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -73868,15 +73990,20 @@ const CJSPolarAreaChart = ({
73868
73990
  formatOptions,
73869
73991
  clientWidth,
73870
73992
  clientHeight,
73871
- colorBank = CJS_DEFAULT_COLORS
73993
+ colorBank = CJS_DEFAULT_COLORS,
73994
+ addLocalFilterFromLib
73872
73995
  }) => {
73996
+ const legendList = useMemo(
73997
+ () => data.LegendList ?? [],
73998
+ [data]
73999
+ );
73873
74000
  const chartData = useMemo(
73874
74001
  // Reuse the circular builder (same shape as pie)
73875
74002
  () => transformToChartJSData(data, "polarArea", formatOptions, colorBank),
73876
74003
  [data, formatOptions, colorBank]
73877
74004
  );
73878
74005
  const chartOptions = useMemo(() => {
73879
- const opts = mapFormatOptionsToChartJS(formatOptions, "polarArea", false);
74006
+ const opts = mapFormatOptionsToChartJS(formatOptions, "polarArea", false, addLocalFilterFromLib, legendList);
73880
74007
  delete opts.scales;
73881
74008
  const xAxisFontStyle = formatOptions.xAxisLabel?.xAxisLabelFontStyle;
73882
74009
  const isItalic = Array.isArray(xAxisFontStyle) ? xAxisFontStyle.includes("Italic") || xAxisFontStyle.includes("italic") : false;
@@ -73917,8 +74044,13 @@ const CJSNormalizedStackColumnChart = ({
73917
74044
  formatOptions,
73918
74045
  clientWidth = 0,
73919
74046
  clientHeight = 0,
73920
- colorBank = CJS_DEFAULT_COLORS
74047
+ colorBank = CJS_DEFAULT_COLORS,
74048
+ addLocalFilterFromLib
73921
74049
  }) => {
74050
+ const legendList = useMemo(
74051
+ () => data.ChartData?.map((s2) => s2.properties),
74052
+ [data]
74053
+ );
73922
74054
  const chartData = useMemo(
73923
74055
  () => transformToNormalizedChartJSData(data, "bar", formatOptions, colorBank),
73924
74056
  [data, formatOptions, colorBank]
@@ -73928,7 +74060,7 @@ const CJSNormalizedStackColumnChart = ({
73928
74060
  [chartData]
73929
74061
  );
73930
74062
  const chartOptions = useMemo(() => {
73931
- const opts = mapFormatOptionsToChartJS(formatOptions, "bar", false);
74063
+ const opts = mapFormatOptionsToChartJS(formatOptions, "bar", false, addLocalFilterFromLib, legendList);
73932
74064
  opts.scales ??= {};
73933
74065
  opts.scales.x ??= {};
73934
74066
  opts.scales.y ??= {};
@@ -73959,8 +74091,13 @@ const CJSNormalizedStackHorizontalBarChart = ({
73959
74091
  formatOptions,
73960
74092
  clientWidth = 0,
73961
74093
  clientHeight = 0,
73962
- colorBank = CJS_DEFAULT_COLORS
74094
+ colorBank = CJS_DEFAULT_COLORS,
74095
+ addLocalFilterFromLib
73963
74096
  }) => {
74097
+ const legendList = useMemo(
74098
+ () => data.ChartData?.map((s2) => s2.properties),
74099
+ [data]
74100
+ );
73964
74101
  const chartData = useMemo(
73965
74102
  () => transformToNormalizedChartJSData(data, "horizontalBar", formatOptions, colorBank),
73966
74103
  [data, formatOptions, colorBank]
@@ -73970,7 +74107,7 @@ const CJSNormalizedStackHorizontalBarChart = ({
73970
74107
  [chartData]
73971
74108
  );
73972
74109
  const chartOptions = useMemo(() => {
73973
- const opts = mapFormatOptionsToChartJS(formatOptions, "horizontalBar", false);
74110
+ const opts = mapFormatOptionsToChartJS(formatOptions, "horizontalBar", false, addLocalFilterFromLib, legendList);
73974
74111
  opts.indexAxis = "y";
73975
74112
  opts.scales ??= {};
73976
74113
  opts.scales.x ??= {};
@@ -74002,8 +74139,13 @@ const CJSNormalizedStackLineChart = ({
74002
74139
  formatOptions,
74003
74140
  clientWidth = 0,
74004
74141
  clientHeight = 0,
74005
- colorBank = CJS_DEFAULT_COLORS
74142
+ colorBank = CJS_DEFAULT_COLORS,
74143
+ addLocalFilterFromLib
74006
74144
  }) => {
74145
+ const legendList = useMemo(
74146
+ () => data.ChartData?.map((s2) => s2.properties),
74147
+ [data]
74148
+ );
74007
74149
  const chartData = useMemo(
74008
74150
  () => transformToNormalizedChartJSData(data, "line", formatOptions, colorBank),
74009
74151
  [data, formatOptions, colorBank]
@@ -74013,7 +74155,7 @@ const CJSNormalizedStackLineChart = ({
74013
74155
  [chartData]
74014
74156
  );
74015
74157
  const chartOptions = useMemo(() => {
74016
- const opts = mapFormatOptionsToChartJS(formatOptions, "line", false);
74158
+ const opts = mapFormatOptionsToChartJS(formatOptions, "line", false, addLocalFilterFromLib, legendList);
74017
74159
  opts.scales ??= {};
74018
74160
  opts.scales.y ??= {};
74019
74161
  opts.scales.y.stacked = true;
@@ -74042,8 +74184,13 @@ const CJSNormalizedStackAreaChart = ({
74042
74184
  formatOptions,
74043
74185
  clientWidth = 0,
74044
74186
  clientHeight = 0,
74045
- colorBank = CJS_DEFAULT_COLORS
74187
+ colorBank = CJS_DEFAULT_COLORS,
74188
+ addLocalFilterFromLib
74046
74189
  }) => {
74190
+ const legendList = useMemo(
74191
+ () => data.ChartData?.map((s2) => s2.properties),
74192
+ [data]
74193
+ );
74047
74194
  const chartData = useMemo(
74048
74195
  () => transformToNormalizedChartJSData(data, "area", formatOptions, colorBank),
74049
74196
  [data, formatOptions, colorBank]
@@ -74053,7 +74200,7 @@ const CJSNormalizedStackAreaChart = ({
74053
74200
  [chartData]
74054
74201
  );
74055
74202
  const chartOptions = useMemo(() => {
74056
- const opts = mapFormatOptionsToChartJS(formatOptions, "area", false);
74203
+ const opts = mapFormatOptionsToChartJS(formatOptions, "area", false, addLocalFilterFromLib, legendList);
74057
74204
  opts.scales ??= {};
74058
74205
  opts.scales.y ??= {};
74059
74206
  opts.scales.y.stacked = true;
@@ -11264,7 +11264,7 @@
11264
11264
  dataLabelsCoordinates: [],
11265
11265
  hideInsignificantValue: false,
11266
11266
  sortBy: "default",
11267
- chartDirection: "top",
11267
+ chartDirection: "right",
11268
11268
  plotAreaRangeFilter: {
11269
11269
  enabled: false,
11270
11270
  condition: "lt",
@@ -54275,6 +54275,12 @@
54275
54275
  let chartData = [];
54276
54276
  let scrollWidth = 0;
54277
54277
  let scrollHeight = 0;
54278
+ let legendListWidth;
54279
+ let displayedLegends = /* @__PURE__ */ new Map();
54280
+ let maxLegendDimensions;
54281
+ let maxMeasure = Number.NEGATIVE_INFINITY;
54282
+ let minMeasure = Number.POSITIVE_INFINITY;
54283
+ let heatMapScale;
54278
54284
  require$$0$1.useEffect(() => {
54279
54285
  drawChart();
54280
54286
  }, [chartId, data, formatOptions]);
@@ -54283,16 +54289,60 @@
54283
54289
  svgRef,
54284
54290
  formatOptions
54285
54291
  ));
54286
- ({ margins, chartTitleHeight, innerHeight, innerWidth } = marginCalculationsForChartsWithoutLegends(
54292
+ dataPreparation();
54293
+ maxLegendDimensions = calculateLegendsMaxPossibleWidth2(displayedLegends);
54294
+ ({ margins, innerHeight, innerWidth, legendListWidth, chartTitleHeight } = marginCalculationsForChartsWithoutAxis(
54287
54295
  chartFormatOptions,
54296
+ width,
54288
54297
  height,
54289
- width
54298
+ maxLegendDimensions,
54299
+ margins
54290
54300
  ));
54291
54301
  initSvg(svgRef, width, height, chartFormatOptions);
54292
54302
  drawChartTitle(svgRef, chartTitleHeight, width, chartFormatOptions);
54293
- dataPreparation();
54294
54303
  scrollWidthHeightCalculation();
54295
54304
  drawOrganizationChart(chartData);
54305
+ initLegendListForOrganizationChart();
54306
+ };
54307
+ const calculateLegendsMaxPossibleWidth2 = (displayedLegendsMap) => {
54308
+ const legends = [];
54309
+ displayedLegendsMap.forEach((_value, key) => {
54310
+ legends.push(key);
54311
+ });
54312
+ const longestLegend = legends.reduce((a2, b) => a2.length > b.length ? a2 : b, "");
54313
+ const legendDims = preCalculateTextDimensions(
54314
+ longestLegend,
54315
+ convertStringToNumber(chartFormatOptions.legends.legendFontSize),
54316
+ chartFormatOptions.legends.legendFontFamily
54317
+ );
54318
+ return [legendDims.width, legendDims.height];
54319
+ };
54320
+ const initLegendListForOrganizationChart = () => {
54321
+ let seriesData = [];
54322
+ displayedLegends.forEach((colors2, label) => {
54323
+ const color2 = `linear-gradient(90deg, ${colors2.join(", ")})`;
54324
+ seriesData.push({
54325
+ properties: {
54326
+ ...legendEntries[0],
54327
+ name: label,
54328
+ alias: label,
54329
+ color: color2
54330
+ }
54331
+ });
54332
+ });
54333
+ initLegendListWithTotalValueAllowance(
54334
+ chartFormatOptions,
54335
+ svg,
54336
+ seriesData,
54337
+ width,
54338
+ height,
54339
+ legendListWidth,
54340
+ chartTitleHeight,
54341
+ chartId,
54342
+ margins,
54343
+ staticLegendShape.rectangle,
54344
+ void 0
54345
+ );
54296
54346
  };
54297
54347
  const dataPreparation = () => {
54298
54348
  try {
@@ -54309,6 +54359,11 @@
54309
54359
  createIdIndexMap(tempData);
54310
54360
  generateUID(tempData);
54311
54361
  chartData = addStyleObjectToChartData(tempData);
54362
+ if (chartFormatOptions.heatMap.showHeatMap) {
54363
+ heatMapScale = sequential().domain([minMeasure, maxMeasure]).interpolator(
54364
+ interpolateRgb$1(chartFormatOptions.heatMap.heatMapMaxColor, chartFormatOptions.heatMap.heatMapMinColor)
54365
+ );
54366
+ }
54312
54367
  } catch (error) {
54313
54368
  logError$2(fileName$1, "dataPreparation", error);
54314
54369
  }
@@ -54365,11 +54420,22 @@
54365
54420
  indexMapForStyleObject.set(styleObject.name, styleObject);
54366
54421
  });
54367
54422
  Object.keys(data2).forEach((key) => {
54368
- const legendObject = indexMapForStyleObject.get(data2[key].UID ?? data2[key].nodeLabel);
54423
+ const nodeObj = data2[key];
54424
+ const legendObject = indexMapForStyleObject.get(nodeObj.UID ?? nodeObj.nodeLabel) ?? legendEntries[0];
54369
54425
  data2[key] = {
54370
- ...data2[key],
54371
- styleObject: legendObject || legendEntries[0]
54426
+ ...nodeObj,
54427
+ styleObject: legendObject
54372
54428
  };
54429
+ if (nodeObj.label) {
54430
+ if (displayedLegends.has(nodeObj.label)) {
54431
+ const colors2 = displayedLegends.get(nodeObj.label);
54432
+ displayedLegends.set(nodeObj.label, [...colors2, legendObject.color ?? "#eedddd"]);
54433
+ } else {
54434
+ displayedLegends.set(nodeObj.label, [legendObject.color ?? "#eedddd"]);
54435
+ }
54436
+ }
54437
+ maxMeasure = Math.max(maxMeasure, nodeObj.value);
54438
+ minMeasure = Math.min(minMeasure, nodeObj.value);
54373
54439
  });
54374
54440
  return data2;
54375
54441
  } catch (error) {
@@ -54410,6 +54476,7 @@
54410
54476
  let connectorVisibility = parseInt(
54411
54477
  chartFormatOptions.connector.connectorLineThickness
54412
54478
  );
54479
+ select$2(floatingSvgRef.current).selectAll("*").remove();
54413
54480
  let organizationalChart = new OrgChart();
54414
54481
  organizationalChart.container(`#floating-${chartId}`).svgWidth(scrollWidth).svgHeight(scrollHeight).nodeHeight((d) => calculateNodeHeight(d)).nodeWidth((d) => calculateNodeWidth(d, true)).layout(chartDirection).diagonal((s2, t, m, offsets = { sy: 0 }) => {
54415
54482
  if (chartDirection == "top" || chartDirection == "bottom" || !chartDirection) {
@@ -54583,7 +54650,7 @@
54583
54650
  justify-content: center;
54584
54651
  align-items: center;
54585
54652
  text-align: center;
54586
- background-color: ${d.data.styleObject.color ? d.data.styleObject.color : d.data.styleObject.backgroundColor};
54653
+ background-color: ${chartFormatOptions.heatMap.showHeatMap ? heatMapScale(d.data.value) : chartFormatOptions.nodes.nodesSingleColor ? chartFormatOptions.nodes.nodesColor : d.data.styleObject.color};
54587
54654
  z-index: 99;
54588
54655
  transform: ${transform};
54589
54656
  transition: unset;">
@@ -58126,9 +58193,14 @@
58126
58193
  if (displayUnits === "Billions") return (value2 / 1e9).toFixed(precision) + "B";
58127
58194
  return value2.toFixed(precision);
58128
58195
  }
58129
- function mapFormatOptionsToChartJS(formatOptions, chartType, hasSecondaryAxis = false) {
58196
+ function findLegendFromAlias(legendList, alias) {
58197
+ return legendList.find((d) => d.alias == alias);
58198
+ }
58199
+ function mapFormatOptionsToChartJS(formatOptions, chartType, hasSecondaryAxis = false, addLocalFilterFromLib, legendList) {
58130
58200
  const isCircular = chartType === "pie" || chartType === "doughnut" || chartType === "polarArea";
58131
58201
  const isHorizontal = chartType === "horizontalBar";
58202
+ let lastClickTime = 0;
58203
+ const DOUBLE_CLICK_DELAY = 300;
58132
58204
  const gridColor = formatOptions.plotArea?.gridLinesColor ?? "#e0e0e0";
58133
58205
  const legendLabelColor = formatOptions.legends?.legendFontColor ?? "#333333";
58134
58206
  const opts = {
@@ -58153,6 +58225,21 @@
58153
58225
  usePointStyle: false,
58154
58226
  boxWidth: 12,
58155
58227
  padding: 16
58228
+ },
58229
+ onClick: function(e, legendItem, legend) {
58230
+ if (addLocalFilterFromLib) {
58231
+ const currentTime = (/* @__PURE__ */ new Date()).getTime();
58232
+ const timeDiff = currentTime - lastClickTime;
58233
+ if (timeDiff < DOUBLE_CLICK_DELAY) {
58234
+ const actualLegend = findLegendFromAlias(legendList, legendItem.text);
58235
+ if (actualLegend) {
58236
+ addLocalFilterFromLib(actualLegend);
58237
+ }
58238
+ lastClickTime = 0;
58239
+ } else {
58240
+ lastClickTime = currentTime;
58241
+ }
58242
+ }
58156
58243
  }
58157
58244
  },
58158
58245
  // ---- Tooltip ----
@@ -73554,9 +73641,14 @@ ${formattedValue}` : formattedValue;
73554
73641
  clientWidth = 0,
73555
73642
  clientHeight = 0,
73556
73643
  isChartStacked,
73557
- colorBank
73644
+ colorBank,
73558
73645
  //= CJS_DEFAULT_COLORS,
73646
+ addLocalFilterFromLib
73559
73647
  }) => {
73648
+ const legendList = require$$0$1.useMemo(
73649
+ () => data.ChartData?.map((s2) => s2.properties),
73650
+ [data]
73651
+ );
73560
73652
  const hasSecondaryAxis = require$$0$1.useMemo(
73561
73653
  () => data.ChartData?.some((s2) => s2.Axis === "Secondary" || s2.properties?.axis === "Secondary"),
73562
73654
  [data]
@@ -73566,7 +73658,7 @@ ${formattedValue}` : formattedValue;
73566
73658
  [data, formatOptions, colorBank]
73567
73659
  );
73568
73660
  const chartOptions = require$$0$1.useMemo(() => {
73569
- const opts = mapFormatOptionsToChartJS(formatOptions, "bar", hasSecondaryAxis);
73661
+ const opts = mapFormatOptionsToChartJS(formatOptions, "bar", hasSecondaryAxis, addLocalFilterFromLib, legendList);
73570
73662
  if (isChartStacked) {
73571
73663
  opts.scales ??= {};
73572
73664
  opts.scales.x ??= {};
@@ -73595,8 +73687,13 @@ ${formattedValue}` : formattedValue;
73595
73687
  clientWidth = 0,
73596
73688
  clientHeight = 0,
73597
73689
  isChartStacked,
73598
- colorBank = CJS_DEFAULT_COLORS
73690
+ colorBank = CJS_DEFAULT_COLORS,
73691
+ addLocalFilterFromLib
73599
73692
  }) => {
73693
+ const legendList = require$$0$1.useMemo(
73694
+ () => data.ChartData?.map((s2) => s2.properties),
73695
+ [data]
73696
+ );
73600
73697
  const hasSecondaryAxis = require$$0$1.useMemo(
73601
73698
  () => data.ChartData?.some((s2) => s2.Axis === "Secondary" || s2.properties?.axis === "Secondary"),
73602
73699
  [data]
@@ -73606,7 +73703,7 @@ ${formattedValue}` : formattedValue;
73606
73703
  [data, formatOptions, colorBank]
73607
73704
  );
73608
73705
  const chartOptions = require$$0$1.useMemo(() => {
73609
- const opts = mapFormatOptionsToChartJS(formatOptions, "horizontalBar", hasSecondaryAxis);
73706
+ const opts = mapFormatOptionsToChartJS(formatOptions, "horizontalBar", hasSecondaryAxis, addLocalFilterFromLib, legendList);
73610
73707
  opts.indexAxis = "y";
73611
73708
  if (isChartStacked) {
73612
73709
  opts.scales ??= {};
@@ -73636,8 +73733,13 @@ ${formattedValue}` : formattedValue;
73636
73733
  clientWidth = 0,
73637
73734
  clientHeight = 0,
73638
73735
  isChartStacked,
73639
- colorBank = CJS_DEFAULT_COLORS
73736
+ colorBank = CJS_DEFAULT_COLORS,
73737
+ addLocalFilterFromLib
73640
73738
  }) => {
73739
+ const legendList = require$$0$1.useMemo(
73740
+ () => data.ChartData?.map((s2) => s2.properties),
73741
+ [data]
73742
+ );
73641
73743
  const hasSecondaryAxis = require$$0$1.useMemo(
73642
73744
  () => data.ChartData?.some((s2) => s2.Axis === "Secondary" || s2.properties?.axis === "Secondary"),
73643
73745
  [data]
@@ -73647,7 +73749,7 @@ ${formattedValue}` : formattedValue;
73647
73749
  [data, formatOptions, colorBank]
73648
73750
  );
73649
73751
  const chartOptions = require$$0$1.useMemo(() => {
73650
- const opts = mapFormatOptionsToChartJS(formatOptions, "line", hasSecondaryAxis);
73752
+ const opts = mapFormatOptionsToChartJS(formatOptions, "line", hasSecondaryAxis, addLocalFilterFromLib, legendList);
73651
73753
  if (isChartStacked) {
73652
73754
  opts.scales ??= {};
73653
73755
  opts.scales.y ??= {};
@@ -73674,8 +73776,13 @@ ${formattedValue}` : formattedValue;
73674
73776
  clientWidth = 0,
73675
73777
  clientHeight = 0,
73676
73778
  isChartStacked,
73677
- colorBank = CJS_DEFAULT_COLORS
73779
+ colorBank,
73780
+ addLocalFilterFromLib
73678
73781
  }) => {
73782
+ const legendList = require$$0$1.useMemo(
73783
+ () => data.ChartData?.map((s2) => s2.properties),
73784
+ [data]
73785
+ );
73679
73786
  const hasSecondaryAxis = require$$0$1.useMemo(
73680
73787
  () => data.ChartData?.some((s2) => s2.Axis === "Secondary" || s2.properties?.axis === "Secondary"),
73681
73788
  [data]
@@ -73685,7 +73792,7 @@ ${formattedValue}` : formattedValue;
73685
73792
  [data, formatOptions, colorBank]
73686
73793
  );
73687
73794
  const chartOptions = require$$0$1.useMemo(() => {
73688
- const opts = mapFormatOptionsToChartJS(formatOptions, "area", hasSecondaryAxis);
73795
+ const opts = mapFormatOptionsToChartJS(formatOptions, "area", hasSecondaryAxis, addLocalFilterFromLib, legendList);
73689
73796
  if (isChartStacked) {
73690
73797
  opts.scales ??= {};
73691
73798
  opts.scales.y ??= {};
@@ -73711,14 +73818,19 @@ ${formattedValue}` : formattedValue;
73711
73818
  formatOptions,
73712
73819
  clientWidth,
73713
73820
  clientHeight,
73714
- colorBank
73821
+ colorBank,
73822
+ addLocalFilterFromLib
73715
73823
  }) => {
73824
+ const legendList = require$$0$1.useMemo(
73825
+ () => data.LegendList ?? [],
73826
+ [data]
73827
+ );
73716
73828
  const chartData = require$$0$1.useMemo(
73717
73829
  () => transformToChartJSData(data, "pie", formatOptions, colorBank),
73718
73830
  [data, formatOptions, colorBank]
73719
73831
  );
73720
73832
  const chartOptions = require$$0$1.useMemo(
73721
- () => mapFormatOptionsToChartJS(formatOptions, "pie", false),
73833
+ () => mapFormatOptionsToChartJS(formatOptions, "pie", false, addLocalFilterFromLib, legendList),
73722
73834
  [formatOptions]
73723
73835
  );
73724
73836
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -73738,14 +73850,19 @@ ${formattedValue}` : formattedValue;
73738
73850
  formatOptions,
73739
73851
  clientWidth,
73740
73852
  clientHeight,
73741
- colorBank = CJS_DEFAULT_COLORS
73853
+ colorBank = CJS_DEFAULT_COLORS,
73854
+ addLocalFilterFromLib
73742
73855
  }) => {
73856
+ const legendList = require$$0$1.useMemo(
73857
+ () => data.LegendList ?? [],
73858
+ [data]
73859
+ );
73743
73860
  const chartData = require$$0$1.useMemo(
73744
73861
  () => transformToChartJSData(data, "doughnut", formatOptions, colorBank),
73745
73862
  [data, formatOptions, colorBank]
73746
73863
  );
73747
73864
  const chartOptions = require$$0$1.useMemo(() => {
73748
- const base = mapFormatOptionsToChartJS(formatOptions, "doughnut", false);
73865
+ const base = mapFormatOptionsToChartJS(formatOptions, "doughnut", false, addLocalFilterFromLib, legendList);
73749
73866
  const rawInner = formatOptions.plotArea?.innerRadius;
73750
73867
  if (rawInner !== void 0 && rawInner !== null) {
73751
73868
  base.cutout = `${rawInner}%`;
@@ -73796,14 +73913,19 @@ ${formattedValue}` : formattedValue;
73796
73913
  formatOptions,
73797
73914
  clientWidth,
73798
73915
  clientHeight,
73799
- colorBank = CJS_DEFAULT_COLORS
73916
+ colorBank = CJS_DEFAULT_COLORS,
73917
+ addLocalFilterFromLib
73800
73918
  }) => {
73919
+ const legendList = require$$0$1.useMemo(
73920
+ () => data.ChartData?.map((s2) => s2.properties),
73921
+ [data]
73922
+ );
73801
73923
  const chartData = require$$0$1.useMemo(
73802
73924
  () => transformToChartJSData(data, "bubble", formatOptions, colorBank),
73803
73925
  [data, formatOptions, colorBank]
73804
73926
  );
73805
73927
  const chartOptions = require$$0$1.useMemo(
73806
- () => mapFormatOptionsToChartJS(formatOptions, "bubble", false),
73928
+ () => mapFormatOptionsToChartJS(formatOptions, "bubble", false, addLocalFilterFromLib, legendList),
73807
73929
  [formatOptions]
73808
73930
  );
73809
73931
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -73871,15 +73993,20 @@ ${formattedValue}` : formattedValue;
73871
73993
  formatOptions,
73872
73994
  clientWidth,
73873
73995
  clientHeight,
73874
- colorBank = CJS_DEFAULT_COLORS
73996
+ colorBank = CJS_DEFAULT_COLORS,
73997
+ addLocalFilterFromLib
73875
73998
  }) => {
73999
+ const legendList = require$$0$1.useMemo(
74000
+ () => data.LegendList ?? [],
74001
+ [data]
74002
+ );
73876
74003
  const chartData = require$$0$1.useMemo(
73877
74004
  // Reuse the circular builder (same shape as pie)
73878
74005
  () => transformToChartJSData(data, "polarArea", formatOptions, colorBank),
73879
74006
  [data, formatOptions, colorBank]
73880
74007
  );
73881
74008
  const chartOptions = require$$0$1.useMemo(() => {
73882
- const opts = mapFormatOptionsToChartJS(formatOptions, "polarArea", false);
74009
+ const opts = mapFormatOptionsToChartJS(formatOptions, "polarArea", false, addLocalFilterFromLib, legendList);
73883
74010
  delete opts.scales;
73884
74011
  const xAxisFontStyle = formatOptions.xAxisLabel?.xAxisLabelFontStyle;
73885
74012
  const isItalic = Array.isArray(xAxisFontStyle) ? xAxisFontStyle.includes("Italic") || xAxisFontStyle.includes("italic") : false;
@@ -73920,8 +74047,13 @@ ${formattedValue}` : formattedValue;
73920
74047
  formatOptions,
73921
74048
  clientWidth = 0,
73922
74049
  clientHeight = 0,
73923
- colorBank = CJS_DEFAULT_COLORS
74050
+ colorBank = CJS_DEFAULT_COLORS,
74051
+ addLocalFilterFromLib
73924
74052
  }) => {
74053
+ const legendList = require$$0$1.useMemo(
74054
+ () => data.ChartData?.map((s2) => s2.properties),
74055
+ [data]
74056
+ );
73925
74057
  const chartData = require$$0$1.useMemo(
73926
74058
  () => transformToNormalizedChartJSData(data, "bar", formatOptions, colorBank),
73927
74059
  [data, formatOptions, colorBank]
@@ -73931,7 +74063,7 @@ ${formattedValue}` : formattedValue;
73931
74063
  [chartData]
73932
74064
  );
73933
74065
  const chartOptions = require$$0$1.useMemo(() => {
73934
- const opts = mapFormatOptionsToChartJS(formatOptions, "bar", false);
74066
+ const opts = mapFormatOptionsToChartJS(formatOptions, "bar", false, addLocalFilterFromLib, legendList);
73935
74067
  opts.scales ??= {};
73936
74068
  opts.scales.x ??= {};
73937
74069
  opts.scales.y ??= {};
@@ -73962,8 +74094,13 @@ ${formattedValue}` : formattedValue;
73962
74094
  formatOptions,
73963
74095
  clientWidth = 0,
73964
74096
  clientHeight = 0,
73965
- colorBank = CJS_DEFAULT_COLORS
74097
+ colorBank = CJS_DEFAULT_COLORS,
74098
+ addLocalFilterFromLib
73966
74099
  }) => {
74100
+ const legendList = require$$0$1.useMemo(
74101
+ () => data.ChartData?.map((s2) => s2.properties),
74102
+ [data]
74103
+ );
73967
74104
  const chartData = require$$0$1.useMemo(
73968
74105
  () => transformToNormalizedChartJSData(data, "horizontalBar", formatOptions, colorBank),
73969
74106
  [data, formatOptions, colorBank]
@@ -73973,7 +74110,7 @@ ${formattedValue}` : formattedValue;
73973
74110
  [chartData]
73974
74111
  );
73975
74112
  const chartOptions = require$$0$1.useMemo(() => {
73976
- const opts = mapFormatOptionsToChartJS(formatOptions, "horizontalBar", false);
74113
+ const opts = mapFormatOptionsToChartJS(formatOptions, "horizontalBar", false, addLocalFilterFromLib, legendList);
73977
74114
  opts.indexAxis = "y";
73978
74115
  opts.scales ??= {};
73979
74116
  opts.scales.x ??= {};
@@ -74005,8 +74142,13 @@ ${formattedValue}` : formattedValue;
74005
74142
  formatOptions,
74006
74143
  clientWidth = 0,
74007
74144
  clientHeight = 0,
74008
- colorBank = CJS_DEFAULT_COLORS
74145
+ colorBank = CJS_DEFAULT_COLORS,
74146
+ addLocalFilterFromLib
74009
74147
  }) => {
74148
+ const legendList = require$$0$1.useMemo(
74149
+ () => data.ChartData?.map((s2) => s2.properties),
74150
+ [data]
74151
+ );
74010
74152
  const chartData = require$$0$1.useMemo(
74011
74153
  () => transformToNormalizedChartJSData(data, "line", formatOptions, colorBank),
74012
74154
  [data, formatOptions, colorBank]
@@ -74016,7 +74158,7 @@ ${formattedValue}` : formattedValue;
74016
74158
  [chartData]
74017
74159
  );
74018
74160
  const chartOptions = require$$0$1.useMemo(() => {
74019
- const opts = mapFormatOptionsToChartJS(formatOptions, "line", false);
74161
+ const opts = mapFormatOptionsToChartJS(formatOptions, "line", false, addLocalFilterFromLib, legendList);
74020
74162
  opts.scales ??= {};
74021
74163
  opts.scales.y ??= {};
74022
74164
  opts.scales.y.stacked = true;
@@ -74045,8 +74187,13 @@ ${formattedValue}` : formattedValue;
74045
74187
  formatOptions,
74046
74188
  clientWidth = 0,
74047
74189
  clientHeight = 0,
74048
- colorBank = CJS_DEFAULT_COLORS
74190
+ colorBank = CJS_DEFAULT_COLORS,
74191
+ addLocalFilterFromLib
74049
74192
  }) => {
74193
+ const legendList = require$$0$1.useMemo(
74194
+ () => data.ChartData?.map((s2) => s2.properties),
74195
+ [data]
74196
+ );
74050
74197
  const chartData = require$$0$1.useMemo(
74051
74198
  () => transformToNormalizedChartJSData(data, "area", formatOptions, colorBank),
74052
74199
  [data, formatOptions, colorBank]
@@ -74056,7 +74203,7 @@ ${formattedValue}` : formattedValue;
74056
74203
  [chartData]
74057
74204
  );
74058
74205
  const chartOptions = require$$0$1.useMemo(() => {
74059
- const opts = mapFormatOptionsToChartJS(formatOptions, "area", false);
74206
+ const opts = mapFormatOptionsToChartJS(formatOptions, "area", false, addLocalFilterFromLib, legendList);
74060
74207
  opts.scales ??= {};
74061
74208
  opts.scales.y ??= {};
74062
74209
  opts.scales.y.stacked = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pace-chart-lib",
3
- "version": "1.0.63",
3
+ "version": "1.0.65",
4
4
  "description": "A simple React + Vite + TS UI library with a Button using custom fonts via SCSS.",
5
5
  "license": "MIT",
6
6
  "type": "module",