@publishfx/publish-chart 2.0.2 → 2.1.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +6 -6
  3. package/dist/adapters/DataAdapter.d.ts +7 -3
  4. package/dist/adapters/DataAdapter.js +61 -0
  5. package/dist/components/g2/base/G2BarChart.d.ts +4 -3
  6. package/dist/components/g2/base/G2BarChart.js +194 -53
  7. package/dist/components/g2/base/G2BarLegend.d.ts +17 -0
  8. package/dist/components/g2/base/G2BarLegend.js +196 -0
  9. package/dist/components/g2/base/G2CombineChart.d.ts +9 -0
  10. package/dist/components/g2/base/G2CombineChart.js +305 -0
  11. package/dist/components/g2/base/G2GaugeChart.js +3 -1
  12. package/dist/components/g2/base/G2GroupBarChart.d.ts +9 -0
  13. package/dist/components/g2/base/G2GroupBarChart.js +227 -0
  14. package/dist/components/g2/base/G2IndicatorCardChart.d.ts +43 -0
  15. package/dist/components/g2/base/G2IndicatorCardChart.js +156 -0
  16. package/dist/components/g2/base/G2LineChart.d.ts +4 -3
  17. package/dist/components/g2/base/G2LineChart.js +207 -104
  18. package/dist/components/g2/base/G2PieChart.d.ts +9 -0
  19. package/dist/components/g2/base/G2PieChart.js +189 -0
  20. package/dist/components/g2/base/g2Helpers.d.ts +293 -0
  21. package/dist/components/g2/base/g2Helpers.js +167 -0
  22. package/dist/components/g2/base/g2bar.d.ts +64 -0
  23. package/dist/components/g2/base/g2bar.js +191 -0
  24. package/dist/components/g2/base/g2combine.d.ts +71 -0
  25. package/dist/components/g2/base/g2combine.js +322 -0
  26. package/dist/components/g2/base/g2groupbar.d.ts +69 -0
  27. package/dist/components/g2/base/g2groupbar.js +188 -0
  28. package/dist/components/g2/base/g2line.d.ts +77 -0
  29. package/dist/components/g2/base/g2line.js +208 -0
  30. package/dist/components/g2/shared/G2CompareTooltip.d.ts +23 -0
  31. package/dist/components/g2/shared/G2CompareTooltip.js +93 -0
  32. package/dist/components/g2/shared/useG2TooltipContainer.d.ts +1 -0
  33. package/dist/components/g2/shared/useG2TooltipContainer.js +16 -0
  34. package/dist/components/shared/NodeDetail.js +1 -1
  35. package/dist/components/shared/NodePopover.d.ts +1 -0
  36. package/dist/components/shared/NodePopover.js +3 -2
  37. package/dist/core/ChartTypes.d.ts +4 -0
  38. package/dist/index.d.ts +5 -0
  39. package/dist/index.js +5 -1
  40. package/dist/utils/chartHelpers.d.ts +1 -1
  41. package/dist/utils/chartHelpers.js +2 -2
  42. package/package.json +15 -13
package/dist/index.js CHANGED
@@ -15,8 +15,12 @@ import GroupLineCompare from "./components/composite/GroupLineCompare.js";
15
15
  import MultipleLine from "./components/composite/MultipleLine.js";
16
16
  import MultipleCompareLine from "./components/composite/MultipleCompareLine.js";
17
17
  import G2BarChart from "./components/g2/base/G2BarChart.js";
18
+ import G2GroupBarChart from "./components/g2/base/G2GroupBarChart.js";
18
19
  import G2LineChart from "./components/g2/base/G2LineChart.js";
20
+ import G2CombineChart from "./components/g2/base/G2CombineChart.js";
21
+ import G2PieChart from "./components/g2/base/G2PieChart.js";
19
22
  import G2GaugeChart from "./components/g2/base/G2GaugeChart.js";
23
+ import G2IndicatorCardChart from "./components/g2/base/G2IndicatorCardChart.js";
20
24
  import { createLazyComponent, createLazyComponents } from "./utils/lazyHelpers.js";
21
25
  import { TypeAdapter } from "./adapters/TypeAdapter.js";
22
26
  import { DataAdapter } from "./adapters/DataAdapter.js";
@@ -26,4 +30,4 @@ import { BigNumberUtil, formatBigNumber, formatIndicatorV2, formatNumberV2, form
26
30
  import { calTextWidth, calculateBarWidth, createStripePatternCanvas, getAxisFormat, getAxisHorPaddingByText, markerStyle, truncateText } from "./utils/chartHelpers.js";
27
31
  import { getIntervalRatio, groupArray, transformIndicatorList } from "./utils/dataTransform.js";
28
32
  import { getIndicator, getIndicatorCompareName, getIndicatorName } from "./utils/indicatorHelpers.js";
29
- export { AuxiliaryLine, BarChart, BarLineAdapter, BarLineChart, BarLineCompareWeekend, BigNumberUtil, ChartProvider, DataAdapter, DefaultDataTransformService, DefaultFormatterService, G2BarChart, G2GaugeChart, G2LineChart, GroupBar, GroupBarLine, GroupCompare, GroupLine, GroupLineCompare, LineChart, MultipleCompareLine, MultipleLine, TypeAdapter, XAxisBackground, calTextWidth, calculateBarWidth, createDataTransformService, createFormatterService, createLazyComponent, createLazyComponents, createStripePatternCanvas, defaultChartConfig, formatBigNumber, formatIndicatorV2, formatNumberV2, formatPercentage, getAxisFormat, getAxisFormatFromContext, getAxisHorPaddingByText, getIndicator, getIndicatorCompareName, getIndicatorName, getIntervalRatio, getThemeColors, groupArray, markerStyle, mergeChartConfig, transformIndicatorList, truncateText, useChartContext };
33
+ export { AuxiliaryLine, BarChart, BarLineAdapter, BarLineChart, BarLineCompareWeekend, BigNumberUtil, ChartProvider, DataAdapter, DefaultDataTransformService, DefaultFormatterService, G2BarChart, G2CombineChart, G2GaugeChart, G2GroupBarChart, G2IndicatorCardChart, G2LineChart, G2PieChart, GroupBar, GroupBarLine, GroupCompare, GroupLine, GroupLineCompare, LineChart, MultipleCompareLine, MultipleLine, TypeAdapter, XAxisBackground, calTextWidth, calculateBarWidth, createDataTransformService, createFormatterService, createLazyComponent, createLazyComponents, createStripePatternCanvas, defaultChartConfig, formatBigNumber, formatIndicatorV2, formatNumberV2, formatPercentage, getAxisFormat, getAxisFormatFromContext, getAxisHorPaddingByText, getIndicator, getIndicatorCompareName, getIndicatorName, getIntervalRatio, getThemeColors, groupArray, markerStyle, mergeChartConfig, transformIndicatorList, truncateText, useChartContext };
@@ -50,4 +50,4 @@ export declare const markerStyle: (baseColor: string, isCompare: boolean) => {
50
50
  */
51
51
  export declare const createStripePatternCanvas: (baseColor: string, spaceUnit?: number) => HTMLCanvasElement;
52
52
  export declare const getChartKey: (config: any) => string;
53
- export declare const splitTextToMultiline: (text: string, maxLength?: number) => string;
53
+ export declare const splitTextToMultiline: (text: string, maxLength?: number, breakString?: string) => string;
@@ -109,9 +109,9 @@ const createStripePatternCanvas = (baseColor, spaceUnit = 24)=>{
109
109
  return patternCanvas;
110
110
  };
111
111
  const getChartKey = (config)=>JSON.stringify(config);
112
- const splitTextToMultiline = (text, maxLength = 5)=>{
112
+ const splitTextToMultiline = (text, maxLength = 5, breakString = '\n')=>{
113
113
  let result = '';
114
- for(let i = 0; i < text.length; i += maxLength)result += text.substring(i, i + maxLength) + '\n';
114
+ for(let i = 0; i < text.length; i += maxLength)result += text.substring(i, i + maxLength) + breakString;
115
115
  return result.trim();
116
116
  };
117
117
  export { calTextWidth, calculateBarWidth, createStripePatternCanvas, getAxisFormat, getAxisHorPaddingByText, getChartKey, markerStyle, splitTextToMultiline, truncateText };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@publishfx/publish-chart",
3
- "version": "2.0.2",
3
+ "version": "2.1.0",
4
4
  "description": "A React chart component library for the Publish platform, including BarChart, LineChart, BarLineChart and other visualization components",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -24,9 +24,20 @@
24
24
  "CHANGELOG.md",
25
25
  "README.md"
26
26
  ],
27
+ "scripts": {
28
+ "build": "rslib build",
29
+ "dev": "rslib build --watch",
30
+ "lint": "eslint src --ext .ts,.tsx",
31
+ "lint:fix": "eslint src --ext .ts,.tsx --fix",
32
+ "test": "jest",
33
+ "test:watch": "jest --watch",
34
+ "test:coverage": "jest --coverage"
35
+ },
27
36
  "devDependencies": {
28
37
  "@antv/data-set": "^0.11.8",
38
+ "@antv/g-pattern": "^2.0.42",
29
39
  "@antv/g2": "^5.3.0",
40
+ "@publishfx/publish-components": "workspace:^",
30
41
  "@types/jest": "^29.5.12",
31
42
  "@types/lodash": "^4.17.20",
32
43
  "@types/react": "^18.3.18",
@@ -44,12 +55,12 @@
44
55
  "react-dom": "^18.3.1",
45
56
  "styled-components": "^5.3.11",
46
57
  "ts-jest": "^29.1.2",
47
- "typescript": "^5.9.3",
48
- "@publishfx/publish-components": "^2.1.0"
58
+ "typescript": "^5.9.3"
49
59
  },
50
60
  "peerDependencies": {
51
61
  "@antv/data-set": "^0.11.8",
52
62
  "@antv/g2": "^5.3.0",
63
+ "@antv/g-pattern": "^2.0.42",
53
64
  "@arco-design/web-react": "^2.66.0",
54
65
  "@types/react": "^18.3.18",
55
66
  "@types/react-dom": "^18.3.5",
@@ -60,14 +71,5 @@
60
71
  "publishConfig": {
61
72
  "access": "public",
62
73
  "registry": "https://registry.npmjs.org/"
63
- },
64
- "scripts": {
65
- "build": "rslib build",
66
- "dev": "rslib build --watch",
67
- "lint": "eslint src --ext .ts,.tsx",
68
- "lint:fix": "eslint src --ext .ts,.tsx --fix",
69
- "test": "jest",
70
- "test:watch": "jest --watch",
71
- "test:coverage": "jest --coverage"
72
74
  }
73
- }
75
+ }