Skip to content

Conversation

rreusser
Copy link
Contributor

@rreusser rreusser commented Aug 4, 2017

This PR does two things:

  1. adds constraintext: 'both' | 'none' | 'inside' | 'outside' in order to resolve this comment on 'marker+text' mode for bar charts #34.
  2. slightly modifies the textpad for outside text in that it keeps the padding but does not factor it into the width of the bar. That means the text is still offset from the bar just a bit but can grow slightly larger before it's constrained.

@rreusser rreusser changed the title Bar text contraint configuration Bar text constraint configuration Aug 5, 2017
expect(traceOut.texfont).toBeUndefined();
expect(traceOut.insidetexfont).toBeUndefined();
expect(traceOut.outsidetexfont).toBeUndefined();
expect(traceOut.constraintext).toBe();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks odd... toBeUndefined?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. Good catch.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


// apply text padding if possible
// Keep the padding so the text doesn't sit right against
// the bars, but don't factor it into barWidth
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good call.


// compute rotation and scale
var rotate = false,
var rotate = false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be a silly question but... why do we have an if(rotate) below if rotate = false and is never changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I'll clean it up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔪 'd

@alexcjohnson
Copy link
Collaborator

Looks great. I had also suggested expanding to fill the bar gap for outside text in stacked mode or with only one bar, but that seems a good deal tricker to implement and this is already a big win, so 💃

@rreusser
Copy link
Contributor Author

rreusser commented Aug 5, 2017

Ah, yeah. So just to confirm, sounds like this wins on pragmatism. Merging, but open to second thoughts if it's worth attacking a more complicated approach.

@rreusser rreusser merged commit 98377fc into master Aug 5, 2017
@rreusser rreusser deleted the bar-text-contraints branch August 5, 2017 04:45
@etpinard etpinard added this to the v1.30.0 milestone Aug 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature something new

Projects

None yet

Development

Successfully merging this pull request may close these issues.

'marker+text' mode for bar charts

3 participants