Add text over AreaChart
See original GitHub issueWhat is the problem?
I want to add Text/label over the areachart region. But when I add Text from react-native-svg to the decorators method, the app crashes without error. If I remove it, the app works fine. I am looking to generate something like this:
- iOS
- Android
Versions: “react-native”: “0.52.0”, “react-native-svg”: “^6.3.1”, “react-native-svg-charts”: “^4.2.0”,
Code to reproduce
// put code here
import React from 'react';
import { Path, Circle, Line, G, Text } from 'react-native-svg'
import { AreaChart } from 'react-native-svg-charts'
import * as shape from 'd3-shape'
const Chart = props => (
<AreaChart
style={{height: 100}}
showGrid={false}
data={props.item}
contentInset={{top: 30, bottom: 30}}
curve={shape.curveNatural}
svg={{fill: '#BFE5EC'}}
renderDecorator={({ x, y, index, value }) => (
<G key={index}>
<Circle
style={{ zIndex: 10}}
cx={x(index)}
cy={y(value)}
r={4}
strokeWidth={2}
stroke={'#20AAC3'}
fill="white"
/>
<Line
x1={x(index)}
y1={"250"}
x2={x(index)}
stroke="#BFE5EC"
strokeWidth="0.3"
/>
<Text
stroke="#383834"
fontSize="12"
x={50}
y={50}
textAnchor="middle"
>Test</Text>
</G>
)}
extras={[
({line}) => (
<Path
key={'line'}
d={line}
strokeWidth={2}
stroke={'#20AAC3'}
fill={'none'}
/>
),
]}
/>
);
export default Chart;
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to add text box to chart in Excel? - ExtendOffice
Generally, you can click Insert tab and select Text Box to insert a text box into Excel, so does inserting text boxes to...
Read more >Adding Text Boxes to Charts in Excel - Causal
To add a text box to a bar chart, first click on the bar that you want to annotate. Then, click the "Insert"...
Read more >Add Text to Point on Control Chart - QI Macros
Click on the point: · Select the QI Macros Chart menu and select Add Text to Point: · A window will open with...
Read more >Excel Charts: Is it possible to add specific text to the bars on a ...
Select the data labels with one click, then with a second single click select a single data label. Type a = sign into...
Read more >How to Add Text Labels in Excel Chart (4 Quick Methods)
1. Insert Text Labels Manually in Excel Chart from Another Column · Firstly, we need to right-click on the data series. · Then,...
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
Ugh, I hate Expo… I’ll try to run your example when I get the chance and see if I can find what’s going on
@JesperLekland That doesn’t work either. 😦 I will find a work around. Thanks.