Skip to content

Commit

Permalink
Replace labelAlign with align
Browse files Browse the repository at this point in the history
  • Loading branch information
el committed Oct 4, 2019
1 parent 4fe3f2e commit 1f40f09
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/axes/labelling.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The scale label configuration is nested under the scale configuration in the `sc
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `display` | `boolean` | `false` | If true, display the axis title.
| `labelAlign` | `string` | `'center'` | Alignment of the axis title. Possible options are `'start'`, `'center'` and `'end'`
| `align` | `string` | `'center'` | Alignment of the axis title. Possible options are `'start'`, `'center'` and `'end'`
| `labelString` | `string` | `''` | The text for the title. (i.e. "# of People" or "Response Choices").
| `lineHeight` | <code>number&#124;string</code> | `1.2` | Height of an individual line of text (see [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/line-height)).
| `fontColor` | `Color` | `'#666'` | Font color for scale title.
Expand Down
6 changes: 3 additions & 3 deletions src/core/core.scale.js
Original file line number Diff line number Diff line change
Expand Up @@ -1205,14 +1205,14 @@ var Scale = Element.extend({
var scaleLabelFont = helpers.options._parseFont(scaleLabel);
var scaleLabelPadding = helpers.options.toPadding(scaleLabel.padding);
var halfLineHeight = scaleLabelFont.lineHeight / 2;
var scaleLabelAlign = scaleLabel.labelAlign;
var scaleAlign = scaleLabel.align;
var position = options.position;
var rotation = 0;
var scaleLabelX, scaleLabelY, textAlign;
var isReverse = me.options.ticks.reverse;

if (me.isHorizontal()) {
switch (scaleLabelAlign) {
switch (scaleAlign) {
case 'start':
scaleLabelX = me.left;
textAlign = isReverse ? 'right' : 'left';
Expand All @@ -1234,7 +1234,7 @@ var Scale = Element.extend({
scaleLabelX = isLeft
? me.left + halfLineHeight + scaleLabelPadding.top
: me.right - halfLineHeight - scaleLabelPadding.top;
switch (scaleLabelAlign) {
switch (scaleAlign) {
case 'start':
scaleLabelY = me.top + (startsAtBottom ? me.height : 0);
textAlign = (startsAtBottom ^ !isLeft) ? 'left' : 'right';
Expand Down

0 comments on commit 1f40f09

Please sign in to comment.