datastake-daf 0.6.310 → 0.6.312

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.
@@ -45822,7 +45822,7 @@ const Chart = _ref => {
45822
45822
  if (typeof legend === 'object') {
45823
45823
  return legend;
45824
45824
  }
45825
- if (legend === true || legend === undefined || isPdf) {
45825
+ if (legend === true || isPdf) {
45826
45826
  return {};
45827
45827
  }
45828
45828
  return null;
@@ -49691,7 +49691,7 @@ function LineChart(_ref) {
49691
49691
  });
49692
49692
  }
49693
49693
 
49694
- const _excluded$5 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isStack", "isGroup", "seriesField", "isPercentage", "showBackground", "formattedYAxis", "formattedXAxis", "color", "height", "groupField", "t", "isPdf", "extraLegendConfig"];
49694
+ const _excluded$5 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isStack", "isGroup", "seriesField", "isPercentage", "showBackground", "formattedYAxis", "formattedXAxis", "color", "height", "groupField", "t", "isPdf", "extraLegendConfig", "shouldSeperateLegendName"];
49695
49695
  const {
49696
49696
  useToken: useToken$c
49697
49697
  } = antd.theme;
@@ -49778,7 +49778,8 @@ function ColumnChart(_ref) {
49778
49778
  groupField,
49779
49779
  t = s => s,
49780
49780
  isPdf = false,
49781
- extraLegendConfig = {}
49781
+ extraLegendConfig = {},
49782
+ shouldSeperateLegendName = false
49782
49783
  } = _ref;
49783
49784
  _objectWithoutProperties(_ref, _excluded$5);
49784
49785
  const containerRef = React__default["default"].useRef(null);
@@ -49823,7 +49824,10 @@ function ColumnChart(_ref) {
49823
49824
  }),
49824
49825
  legend: isPdf ? _objectSpread2({
49825
49826
  itemName: {
49826
- formatter: text => t(text)
49827
+ formatter: text => {
49828
+ const textToTranslate = shouldSeperateLegendName ? text.split("-")[1].toLowerCase() : text;
49829
+ return t(textToTranslate);
49830
+ }
49827
49831
  },
49828
49832
  position: 'bottom'
49829
49833
  }, extraLegendConfig) : hasLegendConfig || false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.310",
3
+ "version": "0.6.312",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -456,6 +456,7 @@ export const Pdf = {
456
456
  renderTooltipContent: renderTooltipContent,
457
457
  showBackground: true,
458
458
  isPercentage: true,
459
+ shouldSeperateLegendName: true,
459
460
  },
460
461
  render: (args) => {
461
462
  return <ColumnChart {...args} />;
@@ -89,6 +89,7 @@ export default function ColumnChart({
89
89
  t = (s) => s,
90
90
  isPdf = false,
91
91
  extraLegendConfig = {},
92
+ shouldSeperateLegendName = false,
92
93
  ...rest
93
94
  }) {
94
95
  const containerRef = React.useRef(null);
@@ -145,7 +146,10 @@ export default function ColumnChart({
145
146
  legend: isPdf
146
147
  ? {
147
148
  itemName: {
148
- formatter: (text) => t(text),
149
+ formatter: (text) => {
150
+ const textToTranslate = shouldSeperateLegendName ? text.split("-")[1].toLowerCase() : text
151
+ return t(textToTranslate)
152
+ },
149
153
  },
150
154
  position: 'bottom',
151
155
  ...extraLegendConfig,
@@ -39,8 +39,8 @@ export const Primary = {
39
39
  "color": "#C04B19"
40
40
  }
41
41
  ],
42
- legend: false,
43
- isPdf: true,
42
+ // legend: false,
43
+ // isPdf: true,
44
44
  isPercentage: true,
45
45
  },
46
46
  };
@@ -66,7 +66,7 @@ const Chart = ({
66
66
  return legend;
67
67
  }
68
68
 
69
- if (legend === true || legend === undefined || isPdf) {
69
+ if (legend === true || isPdf) {
70
70
  return {};
71
71
  }
72
72