Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Custom CategoryBar labels #940

Open
choutianxius opened this issue Jan 31, 2024 · 0 comments
Open

[Feature]: Custom CategoryBar labels #940

choutianxius opened this issue Jan 31, 2024 · 0 comments
Labels
Type: Feature New feature for existing component

Comments

@choutianxius
Copy link

What problem does this feature solve?

Enable the usage of custom category bar label texts, instead of just percentage values.

For example, the following component

<CategoryBar
  className='mt-4'
  values={[25, 25, 25, 25]}
  colors={['sky', 'lime', 'orange', 'rose']}
  markerValue={36}
  labels={[12.5, 15, 17.5, 20, 22.5]} // suppose this new property is added
/>

may display
image

What does the proposed API look like?

Usage:

<CategoryBar
  className='mt-4'
  values={[25, 25, 25, 25]}
  colors={['sky', 'lime', 'orange', 'rose']}
  markerValue={36}
  labels={[12.5, 15, 17.5, 20, 22.5]} // suppose this new property is added
/>

Where the type of labels could be specified with

type LabelType = null | string | number; // null indicates the label should always be omitted from displaying
type LabelsType = LabelType[];

Also, the condition values.length === labels.length - 1 might be forced

@severinlandolt severinlandolt added the Type: Feature New feature for existing component label Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New feature for existing component
Projects
None yet
Development

No branches or pull requests

2 participants