@oliasoft-open-source/charts-library 4.5.0 → 4.5.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.js CHANGED
@@ -26563,16 +26563,22 @@ const LegendItemLine = ({ dataset }) => {
26563
26563
  }
26564
26564
  };
26565
26565
  const LEGEND_SYMBOL_SIZE = 16;
26566
- const renderLegendItemSymbol = (dataset, chartType) => {
26566
+ const renderLegendItemSymbol = (dataset, chartType, index2) => {
26567
26567
  switch (chartType) {
26568
26568
  case ChartType.LINE:
26569
26569
  return /* @__PURE__ */ jsx(LegendItemLine, { dataset });
26570
- case ChartType.BAR:
26571
- return /* @__PURE__ */ jsx("span", { className: styles$3.legendItemBox, children: /* @__PURE__ */ jsx(TbSquareFilled, { color: dataset.borderColor }) });
26570
+ case ChartType.BAR: {
26571
+ const { backgroundColor } = dataset;
26572
+ const color2 = backgroundColor instanceof Array ? backgroundColor[index2] : backgroundColor;
26573
+ return /* @__PURE__ */ jsx("span", { className: styles$3.legendItemBox, children: /* @__PURE__ */ jsx(TbSquareFilled, { color: color2 }) });
26574
+ }
26572
26575
  case ChartType.PIE:
26573
26576
  return /* @__PURE__ */ jsx("span", { className: styles$3.legendItemPoint, children: /* @__PURE__ */ jsx(Icon, { icon: /* @__PURE__ */ jsx(SvgCircle, {}) }) });
26574
- case ChartType.SCATTER:
26575
- return /* @__PURE__ */ jsx("span", { className: styles$3.legendItemPoint, children: /* @__PURE__ */ jsx(TbCircleFilled, { color: dataset.borderColor }) });
26577
+ case ChartType.SCATTER: {
26578
+ const { backgroundColor, borderColor } = dataset;
26579
+ const color2 = backgroundColor instanceof Array ? backgroundColor[index2] : backgroundColor;
26580
+ return /* @__PURE__ */ jsx("span", { className: styles$3.legendItemPoint, children: /* @__PURE__ */ jsx(TbCircleFilled, { color: color2 ?? borderColor }) });
26581
+ }
26576
26582
  default:
26577
26583
  return null;
26578
26584
  }
@@ -26581,7 +26587,8 @@ const LegendItem = ({
26581
26587
  hidden,
26582
26588
  dataset,
26583
26589
  handleClick,
26584
- chartType
26590
+ chartType,
26591
+ index: index2
26585
26592
  }) => {
26586
26593
  return /* @__PURE__ */ jsxs(
26587
26594
  "div",
@@ -26594,7 +26601,7 @@ const LegendItem = ({
26594
26601
  {
26595
26602
  className: styles$3.legendItemSymbol,
26596
26603
  style: { width: LEGEND_SYMBOL_SIZE },
26597
- children: renderLegendItemSymbol(dataset, chartType)
26604
+ children: renderLegendItemSymbol(dataset, chartType, index2)
26598
26605
  }
26599
26606
  ),
26600
26607
  /* @__PURE__ */ jsx("span", { className: styles$3.legendItemText, children: dataset.label })
@@ -26666,13 +26673,14 @@ const LegendItems = ({
26666
26673
  datasets,
26667
26674
  legendClick,
26668
26675
  chartType
26669
- }) => /* @__PURE__ */ jsx("div", { className: styles$3.legendItems, children: items.map((item) => {
26676
+ }) => /* @__PURE__ */ jsx("div", { className: styles$3.legendItems, children: items.map((item, index2) => {
26670
26677
  if (datasets[item.datasetIndex].hideLegend) {
26671
26678
  return null;
26672
26679
  }
26673
26680
  return /* @__PURE__ */ jsx(
26674
26681
  LegendItem,
26675
26682
  {
26683
+ index: index2,
26676
26684
  hidden: item.hidden,
26677
26685
  dataset: datasets[item.datasetIndex],
26678
26686
  handleClick: (_2) => legendClick(_2, item),