@easyv/charts 1.4.16 → 1.4.18

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 (48) hide show
  1. package/.husky/commit-msg +1 -1
  2. package/lib/components/AnimateData.js +16 -8
  3. package/lib/components/Axis.js +128 -82
  4. package/lib/components/Background.js +24 -16
  5. package/lib/components/Band.js +89 -62
  6. package/lib/components/BaseLine.js +41 -29
  7. package/lib/components/Brush.js +46 -29
  8. package/lib/components/Carousel.js +40 -13
  9. package/lib/components/CartesianChart.js +98 -78
  10. package/lib/components/Chart.js +36 -23
  11. package/lib/components/ChartContainer.js +27 -18
  12. package/lib/components/ConicalGradient.js +68 -35
  13. package/lib/components/ExtentData.js +17 -9
  14. package/lib/components/FilterData.js +27 -16
  15. package/lib/components/Indicator.js +8 -6
  16. package/lib/components/Label.js +123 -83
  17. package/lib/components/Legend.js +66 -41
  18. package/lib/components/Lighter.js +48 -19
  19. package/lib/components/Line.js +59 -39
  20. package/lib/components/LinearGradient.js +20 -14
  21. package/lib/components/Mapping.js +34 -9
  22. package/lib/components/Marquee.js +30 -14
  23. package/lib/components/PieChart.js +400 -306
  24. package/lib/components/StackData.js +18 -8
  25. package/lib/components/StereoBar.js +105 -65
  26. package/lib/components/TextOverflow.js +25 -9
  27. package/lib/components/Tooltip.js +55 -41
  28. package/lib/components/index.js +27 -0
  29. package/lib/context/index.js +2 -0
  30. package/lib/element/ConicGradient.js +35 -29
  31. package/lib/element/Line.js +13 -9
  32. package/lib/element/index.js +2 -0
  33. package/lib/formatter/index.js +2 -0
  34. package/lib/formatter/legend.js +41 -30
  35. package/lib/hooks/index.js +8 -0
  36. package/lib/hooks/useAnimateData.js +16 -3
  37. package/lib/hooks/useAxes.js +115 -65
  38. package/lib/hooks/useCarouselAxisX.js +56 -26
  39. package/lib/hooks/useExtentData.js +46 -14
  40. package/lib/hooks/useFilterData.js +29 -8
  41. package/lib/hooks/useStackData.js +30 -7
  42. package/lib/hooks/useTooltip.js +43 -26
  43. package/lib/index.js +15 -0
  44. package/lib/utils/index.js +247 -95
  45. package/package.json +1 -1
  46. package/src/components/CartesianChart.js +6 -6
  47. package/src/components/Label.js +8 -2
  48. package/src/components/TextOverflow.tsx +4 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyv/charts",
3
- "version": "1.4.16",
3
+ "version": "1.4.18",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -151,12 +151,6 @@ const Chart = memo(
151
151
  </svg>
152
152
  </foreignObject>
153
153
  )}
154
- {[...axes.values()].reverse().map((item, index) => {
155
- const config = item.axisType == 'x' ? axisX : item;
156
- return (
157
- <Axis triggerClick={onInteraction} xLineRange={xLineRange} yLineRange={yLineRange} {...config} key={index} />
158
- );
159
- })}
160
154
  {showTooltip && <Indicator {...indicator} {...indicatorAttr} />}
161
155
  <foreignObject style={isVertical?{
162
156
  width:xLineRange+marginRight+marginLeft,
@@ -203,6 +197,12 @@ const Chart = memo(
203
197
  })}
204
198
  </svg>
205
199
  </foreignObject>
200
+ {[...axes.values()].reverse().map((item, index) => {
201
+ const config = item.axisType == 'x' ? axisX : item;
202
+ return (
203
+ <Axis triggerClick={onInteraction} xLineRange={xLineRange} yLineRange={yLineRange} {...config} key={index} />
204
+ );
205
+ })}
206
206
  {baseLineData &&
207
207
  baseLineData.length > 0 &&
208
208
  baseLineData.map((item, index) => {
@@ -2,7 +2,7 @@
2
2
  * 轴类图表标签
3
3
  */
4
4
  import { memo, useContext } from "react";
5
- import { getTranslate2d, getSeriesInfo } from "../utils";
5
+ import { getTranslate2d, getSeriesInfo, getFontStyle } from "../utils";
6
6
  import { chartContext } from "../context";
7
7
 
8
8
  export default memo(
@@ -120,6 +120,9 @@ const Label = ({
120
120
  config: {
121
121
  font,
122
122
  translate: { x: translateX = 0, y: translateY = 0 },
123
+ suffix:{
124
+ content, font:suffixFont, translate:{ x:suffixX, y:suffixY }
125
+ }
123
126
  },
124
127
  textAnchor = "middle",
125
128
  dominantBaseline = "middle",
@@ -136,7 +139,10 @@ const Label = ({
136
139
  dominantBaseline={dominantBaseline}
137
140
  {...font}
138
141
  >
139
- {value}
142
+ <tspan>{value}</tspan>
143
+ <tspan dx={suffixX} dy={suffixY} style={{
144
+ ...getFontStyle(suffixFont,"svg")
145
+ }}>{content}</tspan>
140
146
  </text>
141
147
  );
142
148
  };
@@ -47,6 +47,9 @@ export default memo(forwardRef((props:flowText, ref:any) => {
47
47
  ...getTextOverflow(type),
48
48
  ...style
49
49
  }
50
+ const textDom = document.createElement("div");
51
+ textDom.innerHTML = value;
52
+ const text = textDom.innerText;
50
53
  return type == 'marquee' ? (
51
54
  <Marquee
52
55
  value={value}
@@ -54,6 +57,6 @@ export default memo(forwardRef((props:flowText, ref:any) => {
54
57
  style={styles}
55
58
  ref={ref} />
56
59
  ) : (
57
- <div style={styles} ref={ref} title={type=="ellipsis"?value.replace(/<\/?.+?>/g,"") || undefined:undefined} dangerouslySetInnerHTML={{__html:value}}></div>
60
+ <div style={styles} ref={ref} title={type=="ellipsis"?text || undefined:undefined} dangerouslySetInnerHTML={{__html:value}}></div>
58
61
  );
59
62
  }));