Skip to content

Commit 89ea984

Browse files
committed
fix: better showDatumElements support
1 parent da1b148 commit 89ea984

File tree

3 files changed

+34
-41
lines changed

3 files changed

+34
-41
lines changed

src/seriesTypes/Area.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,21 +95,18 @@ export default function AreaComponent<TDatum>({
9595
cx={getX(datum)}
9696
cy={getY(datum, 1) ?? NaN}
9797
stroke="rgba(33,33,33,0.5)"
98-
fill="transparent"
9998
style={{
10099
// @ts-ignore
101100
r: 2,
102-
opacity: 1,
103-
...(!secondaryAxis.showDatumElements
104-
? {
105-
opacity: 0,
106-
pointerEvents: 'none',
107-
}
108-
: {}),
109101
...style,
110102
...style.circle,
111103
...dataStyle,
112104
...dataStyle.circle,
105+
...(!(secondaryAxis.showDatumElements ?? true)
106+
? {
107+
opacity: 0,
108+
}
109+
: {}),
113110
}}
114111
/>
115112
)

src/seriesTypes/Line.tsx

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@ const pathDefaultStyle = {
1111
strokeWidth: 2,
1212
}
1313

14-
const circleDefaultStyle = {
15-
r: 2,
16-
strokeWidth: '1',
17-
stroke: '#000000',
18-
fill: '#000000',
19-
opacity: 1,
20-
}
21-
2214
export default function Line<TDatum>({
2315
primaryAxis,
2416
secondaryAxis,
@@ -76,31 +68,36 @@ export default function Line<TDatum>({
7668

7769
return (
7870
<g key={`lines-${i}`}>
79-
{(secondaryAxis.showDatumElements ?? true) &&
80-
series.datums.map((datum, i) => {
81-
const dataStyle = getDatumStatusStyle(datum, focusedDatum)
71+
{series.datums.map((datum, i) => {
72+
const dataStyle = getDatumStatusStyle(datum, focusedDatum)
8273

83-
return (
84-
<circle
85-
key={i}
86-
ref={el => {
87-
datum.element = el
88-
}}
89-
r={2}
90-
cx={getX(datum)}
91-
cy={getY(datum)}
92-
stroke="rgba(33,33,33,0.5)"
93-
fill="transparent"
94-
style={{
95-
...circleDefaultStyle,
96-
...style,
97-
...style.circle,
98-
...dataStyle,
99-
...dataStyle.circle,
100-
}}
101-
/>
102-
)
103-
})}
74+
return (
75+
<circle
76+
key={i}
77+
ref={el => {
78+
datum.element = el
79+
}}
80+
r={2}
81+
cx={getX(datum)}
82+
cy={getY(datum)}
83+
stroke="rgba(33,33,33,0.5)"
84+
fill="transparent"
85+
style={{
86+
// @ts-ignore
87+
r: 2,
88+
...style,
89+
...style.circle,
90+
...dataStyle,
91+
...dataStyle.circle,
92+
...(!(secondaryAxis.showDatumElements ?? true)
93+
? {
94+
opacity: 0,
95+
}
96+
: {}),
97+
}}
98+
/>
99+
)
100+
})}
104101
<path d={linePath} style={lineStyle} />
105102
</g>
106103
)

src/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ export type AxisOptionsBase = {
215215
primaryAxisId?: string
216216
elementType?: 'line' | 'area' | 'bar'
217217
showDatumElements?: boolean
218-
showOrphanDatumElements?: boolean
219218
curve?: CurveFactory
220219
invert?: boolean
221220
position: Position

0 commit comments

Comments
 (0)