Skip to content

Add label at the top of StackedBar #3055

@mMarcos208

Description

@mMarcos208

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct

Feature Request

Add label at the top of StackedBar

                <CartesianChart
                  data={data}
                  xKey="x"
                  yKeys={yKeys as never[]}
                  domainPadding={{left: 50, right: 50, top: 30}}
                  domain={{y: [0, maxDomain]}}
                  padding={5}
                  axisOptions={{
                    lineColor: {
                      grid: {
                        x: theme.backgroundColor,
                        y: theme.colors.input.label,
                      },
                      frame: theme.backgroundColor,
                    },
                    labelColor: {
                      x: colors.silverTree,
                      y: colors.silverTree,
                    },
                    font: InterRegularFont,
                    formatYLabel: (value) => integerFormatter(value as number),
                    formatXLabel: () => '',
                  }}
                >
                  {({points, chartBounds}) => {
                    const pointsKeyed = yKeys.map((x) => points[x as keyof typeof points])
                    return (
                      <StackedBar
                        animate={{type: 'spring'}}
                        innerPadding={innerPadding}
                        chartBounds={chartBounds}
                        points={pointsKeyed}
                        colors={[
                          colors.pastelPink,
                          colors.contessa,
                          colors.nightShadz,
                          colors.redDevil,
                          colors.rosewood,
                          colors.castro,
                          colors.temptress,
                        ]}
                        barOptions={({isBottom, isTop}) => {
                          return {
                            roundedCorners: isTop
                              ? {
                                  topLeft: 5,
                                  topRight: 5,
                                }
                              : isBottom
                              ? {
                                  bottomRight: 5,
                                  bottomLeft: 5,
                                }
                              : undefined,
                          }
                        }}
                      />
                    )
                  }}
                </CartesianChart>

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue: StaleThis issue is marked as stale and will close in 14 daysType: Enhancement ✏️An enhancement or feature proposal that will be addressed after the next release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions