Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix examples in voronai container
  • Loading branch information
Burnett2k committed Feb 8, 2024
commit c5a341f254873fcee2fcd16c485d500d977e7c5d
48 changes: 47 additions & 1 deletion demo/ts/components/victory-voronoi-container-demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,59 @@ export default class VictoryVoronoiContainerDemo extends React.Component<
<div style={containerStyle}>
<VictoryChart
style={chartStyle}
domain={{ y: [0, 6] }}
scale={{ y: "log" }}
containerComponent={
<VictoryVoronoiContainer
voronoiDimension="x"
labels={({ datum }) => `y: ${datum.y}`}
labelComponent={<VictoryTooltip />}
/>
}
>
<VictoryScatter
style={{ data: { fill: "red" }, labels: { fill: "red" } }}
data={[
{ x: 0, y: 2500 },
{ x: 2, y: 3300 },
{ x: 4, y: 4300 },
{ x: 6, y: 2400 },
{ x: 8, y: 3300 },
{ x: 10, y: 5400 },
{ x: 12, y: 8900 },
]}
/>
<VictoryScatter
data={[
{ x: 0, y: 200 },
{ x: 2, y: 3100 },
{ x: 4, y: 2500 },
{ x: 6, y: 870 },
{ x: 8, y: 2300 },
{ x: 10, y: 550 },
{ x: 12, y: 5200 },
]}
/>
</VictoryChart>

<VictoryChart
style={chartStyle}
domain={{ y: [0, 6] }}
containerComponent={
<VictoryVoronoiContainer
voronoiDimension="x"
labels={({ datum }) => `y: ${datum.y}`}
labelComponent={
<VictoryTooltip
// TODO: active points is not exported properly, so this throws a type error
text={({ activePoints }) => {
return activePoints
.map(({ y }) => `value: ${y}`)
.join(" - ");
}}
/>
}
/>
}
>
<VictoryScatter
style={{ data: { fill: "red" }, labels: { fill: "red" } }}
Expand All @@ -125,6 +170,7 @@ export default class VictoryVoronoiContainerDemo extends React.Component<
]}
/>
</VictoryChart>

<VictoryChart
height={450}
domain={{ y: [0, 1] }}
Expand Down