Skip to content

Bar Chart: Labels #204

Answered by rokotyan
errantmind asked this question in Q&A
May 18, 2023 · 4 comments · 3 replies
Discussion options

You must be logged in to vote

@errantmind Yes, you can achieve that by using the XYLabels component. We don't have docs for it yet, but here's a brief code snippet for React to give you an example:

<VisXYContainer>
  <VisStackedBar data={data} x={d => d.x} y={accessors} />
  <VisXYLabels
    data={data}
    y={d => d.y / 2}
    x={d => d.x}
    label={d => `${d.y.toFixed(1)} bps`}
  />
  <VisAxis type='x' numTicks={10}/>
  <VisAxis type='y' tickFormat={(y: number) => `${y}bps`}/>
</VisXYContainer>

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by errantmind
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@rokotyan
Comment options

Comment options

You must be logged in to vote
2 replies
@crllnsmnn
Comment options

@rokotyan
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants