@semcore/d3-chart 1.5.0 → 1.5.4

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.
@@ -48,8 +48,18 @@ class HorizontalBarRoot extends Component {
48
48
  const barY = yScale(d[y]) + offset[1];
49
49
  const barX = xScale(Math.min(d[x0] ?? 0, d[x])) + offset[0];
50
50
  const height = heightProps || getBandwidth(yScale);
51
- const width = Math.abs(xScale(d[x]) - Math.max(xScale(xScale.domain()[0]), xScale(d[x0] ?? 0)));
51
+ let width = Math.abs(xScale(d[x]) - Math.max(xScale(xScale.domain()[0]), xScale(d[x0] ?? 0)));
52
+ width = isRounded ? width + r : width;
52
53
  const isRounded = r !== 0;
54
+ const xValue = isRounded ? (d[x] > 0 ? barX : barX - r) : barX;
55
+ const dSvg = getHorizontalRect({
56
+ x: xValue,
57
+ y: barY,
58
+ width,
59
+ height,
60
+ radius: r,
61
+ position: d[x] > 0 ? 'right' : 'left',
62
+ });
53
63
 
54
64
  return sstyled(styles)(
55
65
  <SBar
@@ -62,14 +72,11 @@ class HorizontalBarRoot extends Component {
62
72
  index={i}
63
73
  hide={hide}
64
74
  color={color}
65
- d={getHorizontalRect({
66
- x: isRounded ? (d[x] > 0 ? barX : barX - r) : barX,
67
- y: barY,
68
- width: isRounded ? width + r : width,
69
- height,
70
- radius: r,
71
- position: d[x] > 0 ? 'right' : 'left',
72
- })}
75
+ x={xValue}
76
+ y={barY}
77
+ width={width}
78
+ height={height}
79
+ d={dSvg}
73
80
  use:duration={`${duration}ms`}
74
81
  onMouseMove={onMouseMove}
75
82
  onMouseLeave={onMouseLeave}
package/src/Hover.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import { Component, sstyled } from '@semcore/core';
3
3
  import createElement from './createElement';
4
- import trottle from '@semcore/utils/lib/rafTrottle';
5
4
  import canUseDOM from '@semcore/utils/lib/canUseDOM';
6
5
  import { scaleOfBandwidth, getIndexFromData, eventToPoint, invert, CONSTANT } from './utils';
6
+ import trottle from '@semcore/utils/lib/rafTrottle';
7
7
 
8
8
  import style from './style/hover.shadow.css';
9
9
 
package/src/Line.js CHANGED
@@ -14,8 +14,8 @@ class LineRoot extends Component {
14
14
  static style = style;
15
15
  static enhance = [uniqueIDEnhancement()];
16
16
 
17
- static defaultProps = ({ x, y, $rootProps, curve = curveLinear }) => {
18
- const [xScale, yScale] = $rootProps.scale;
17
+ static defaultProps = ({ x, y, $rootProps, curve = curveLinear, scale }) => {
18
+ const [xScale, yScale] = scale || $rootProps.scale;
19
19
  return {
20
20
  d3: d3Line()
21
21
  .defined(definedData(x, y))
package/src/Plot.js CHANGED
@@ -39,6 +39,7 @@ class PlotRoot extends Component {
39
39
 
40
40
  handlerMouseLeave = (e) => {
41
41
  this.eventEmitter.emit(`onMouseLeaveRoot`, e);
42
+ this.eventEmitter.emit('onMouseLeaveChart', e);
42
43
  };
43
44
 
44
45
  setContext() {