OttherCreek
OttherCreek

Reputation: 993

Add label to ReferenceLine in recharts

I want to add a <Label/> to a <ReferenceLine/>. This works but I want the <Label/>s position to be on the line (or near the line) instead of being in the right corner (-> image).

Here is my code:

<ReferenceLine type="monotone" y={props.data.avgAll} fill="violett" stroke="#8884d8">
   <Label content={<AverageCircle/>} position={"center"}/>
</ReferenceLine>

Any suggestions how to do that?

Upvotes: 0

Views: 3448

Answers (1)

user15058956
user15058956

Reputation:

Change the position from center to top

<ReferenceLine type="monotone" y={props.data.avgAll} fill="violett" stroke="#8884d8">
   <Label content={<AverageCircle/>} position={"top"}/>
</ReferenceLine>

you can refer to the documentation here

Upvotes: 2

Related Questions