Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
kurkle committed Mar 9, 2021
1 parent 5a67cca commit 60b5c74
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/core/core.scale.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {_alignStartEnd, _toLeftRightCenter} from '../helpers/helpers.extras';
import {toFont, toPadding} from '../helpers/helpers.options';
import Ticks from './core.ticks';

const reverseAling = (align) => align === 'left' ? 'right' : align === 'right' ? 'left' : align;
const reverseAlign = (align) => align === 'left' ? 'right' : align === 'right' ? 'left' : align;
const offsetFromEdge = (scale, edge, offset) => edge === 'top' || edge === 'left' ? scale[edge] + offset : scale[edge] - offset;

/**
* @typedef { import("./core.controller").default } Chart
Expand Down Expand Up @@ -323,13 +324,11 @@ function createTickContext(parent, index, tick) {
function titleAlign(align, position, reverse) {
let ret = _toLeftRightCenter(align);
if ((reverse && position !== 'right') || (!reverse && position === 'right')) {
ret = reverseAling(ret);
ret = reverseAlign(ret);
}
return ret;
}

const offsetFromEdge = (scale, edge, offset) => edge === 'top' || edge === 'left' ? scale[edge] + offset : scale[edge] - offset;

function titleArgs(scale, offset, position, align) {
const {top, left, bottom, right} = scale;
let rotation = 0;
Expand Down Expand Up @@ -1691,7 +1690,7 @@ export default class Scale extends Element {
/**
* @protected
*/
drawTitle(chartArea) { // eslint-disable-line no-unused-vars
drawTitle() {
const {ctx, options: {position, title, reverse}} = this;

if (!title.display) {
Expand Down

0 comments on commit 60b5c74

Please sign in to comment.