我有一个折线图react-native-svg-charts
,我想在行尾包含一个 40 像素 x 40 像素的 PNG 图像。这是我当前的代码:
<View style={styles.chartContainer}>
<LineChart
data={chartData}
style={{ height: 100 }}
svg={{ strokeWidth: 5, stroke: 'url(#gradient)' }}
curve={shape.curveNatural}
yMin={0}
yMax={15}
xMax={chartData.length + 1}
contentInset={{ top: 30, bottom: 0, left: 50 }}>
<Gradient />
</LineChart>
<View style={styles.chartFloor}></View>
</View>
它看起来像这样:
我需要让它看起来像这样:
我可以使用图表数据中的值来计算绝对位置,然后只使用常规图像,但也许使用 SVG 有更简单的方法。
作为记录,PNG 图标也可以是 SVG(我在 SVG 中也有)。