Unable to use reactelement for reference line
See original GitHub issueDo you want to request a feature or report a bug?
Bug report
What is the current behavior?
When i use plain text for the label of a reference line, everything works ok. But say i put in a react element (Ie <span>hello</span>
), nothing displays.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template: http://jsfiddle.net/ndLhnegs/).
<AreaChart ....>
.....
<ReferenceLine label={<span>hello</span>} />
</AreaChart>
The resulting HTML
<g class="recharts-layer recharts-reference-line">
<line x="23" stroke="green" fill="none" fill-opacity="1" stroke-width="1" x1="469.15789473684214" y1="270" x2="469.15789473684214" y2="20" class="recharts-reference-line-line"></line>
<span content="[object Object]" viewBox="[object Object]" offset="5">hello</span>
</g>
What is the expected behavior?
Should see “hello” on the reference line
Which versions of Recharts, and which browser / OS are affected by this issue? Did this work in previous versions of Recharts?
recharts@^1.5.0
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:5 (1 by maintainers)
Top Results From Across the Web
reactjs - No component displayed when adding a custom label ...
Currently, we can customise the label using an object but when passing our own element in nothing is rendered. <ReferenceLine y={dataLimits.lL} ...
Read more >JSX In Depth - React
Capitalized types indicate that the JSX tag is referring to a React component. These tags get compiled into a direct reference to the...
Read more >Understanding common frustrations with React Hooks
React Hooks can be frustrating despite their popularity and widespread use. Learn about some of the drawbacks to using React Hooks.
Read more >Type Reference - JavaScript. Flow
A reference for all the utility Flow types exported by the React module.
Read more >How To Create React Elements with JSX - DigitalOcean
That means you can't use certain words in any JavaScript code. ... add the following highlighted lines to reference an attribute:.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@xile611 well im actually trying to render something more complicated than “hello”, but since the simple use case doesn’t work as documented, i figured i’d start with that.
What I’m actually trying to accomplish is saying hello with a 90 degree rotation
This works (but not in IE…)