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

For a multiline VictoryLabel, I would like to have different lineHeights per line. #902

Closed
2 tasks done
sbcreates opened this issue Jan 16, 2018 · 1 comment
Closed
2 tasks done
Assignees

Comments

@sbcreates
Copy link

sbcreates commented Jan 16, 2018

Feature Requests

Checklist

  • I've read through the Docs and Guides to make sure this functionality doesn't already exist

  • I've searched open issues to make sure I'm not opening a duplicate issue

Description

I would like to create a pie chart that is styled like this:

image

I can create multiline text and I can style each line of text individually with its own color and font size. However, I can't individually apply line height for each line and it's resulting in spacing issues because of the different font sizes.


      <VictoryPie
          standalone={false}
          height={600}
          width={600}
          data={data}
          colorScale={['green', 'lightgray']}
          innerRadius={225}
          labelRadius={700}
          style={{ labels: { fontSize: 20, fill: 'black' } }}
      />
      <VictoryLabel
          textAnchor="middle"
          //lineHeight={[{1.22}, {2}, {3}, {1}]} <-- doesn't work
          x={300} y={300}
          style={[{ fontSize: 50, fill: '#203648' }, { fontSize: 70, fill: 'green' }, { fontSize: 30, fill: 'gray' }, { fontSize: 30, fill: 'gray' }]}
          text={[title, remaining, 'remaining', 'of ' + total]}
      />

image
This is what I currently have. I would like to customize spacing between the lines of text. The title and remaining spacing is off and I cannot currently figure out how to correct it.

@boygirl
Copy link
Contributor

boygirl commented Jan 16, 2018

@sbcreates This is most easily accomplished by using multiple VictoryLabel components.

@boygirl boygirl closed this as completed Jan 16, 2018
@boygirl boygirl reopened this Jan 16, 2018
@parkerziegler parkerziegler self-assigned this Jan 16, 2018
@boygirl boygirl closed this as completed Jan 19, 2018
boygirl added a commit that referenced this issue Jul 17, 2018
Add support for inlining multiple text and passing an array via the lineHeight prop. Features for #893, #902, and #904.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants