简体   繁体   English

Recharts条形图背景新增边框半径

[英]Added border radius to the background of bar chart in Recharts

I am trying to create a bar chart with custom stylings.我正在尝试创建一个带有自定义样式的条形图。 So needed border radius to the bar.所以需要到栏的边界半径。 Able to add border radius to the bar but not able to add border radius to the background that were left.能够将边框半径添加到栏,但不能将边框半径添加到剩下的背景。 Any idea how can I achieve this.知道我怎样才能做到这一点。 Added my code below.在下面添加了我的代码。 Thank you in advance.先感谢您。

                   <BarChart
                        data={timelineDetailsData(metrics.dates.today, metrics.dates.middle)}
                        barGap={14}
                        margin={{
                            top: 0,
                            right: 0,
                            left: 0,
                            bottom: 0
                        }}
                        maxBarSize={2000}
                        barSize={100}
                        layout="vertical">
                        <XAxis
                            domain={[0,
                                monthDiff(
                                    new Date(parseInt(metrics.dates.today.split(" ")[1]), getMonthsinNumber[metrics.dates.today.split(" ")[0].toLowerCase()]),
                                    new Date(parseInt(metrics.dates.latest.split(" ")[1]), getMonthsinNumber[metrics.dates.latest.split(" ")[0].toLowerCase()])
                                )]} tick={false} axisLine={false} type="number" tickLine={false} padding={{ left: 0, right: 0 }} />
                        <YAxis type="category" dataKey="currency" axisLine={false} tickLine={false}
                        />
                        <Bar background dataKey="middleDate" fill="#2E76B6" radius={10} barSize={60} >
                            <LabelList dataKey="timelabel" position="insideLeft" style={{ fill: "white" }} />
                        </Bar>
                    </BarChart>

在此处输入图像描述

<Bar 
   background={{
       radius: 20
   }}
/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM