Ver a proveniência

fix: set default translate to 0 if invalid

tags/v1.5.2
Shivam Mishra há 4 anos
ascendente
cometimento
773f93c414
1 ficheiros alterados com 5 adições e 1 eliminações
  1. +5
    -1
      src/js/utils/draw.js

+ 5
- 1
src/js/utils/draw.js Ver ficheiro

@@ -1,5 +1,5 @@
import { getBarHeightAndYAttr, truncateString, shortenLargeNumber, getSplineCurvePointsStr } from './draw-utils'; import { getBarHeightAndYAttr, truncateString, shortenLargeNumber, getSplineCurvePointsStr } from './draw-utils';
import { getStringWidth } from './helpers';
import { getStringWidth, isValidNumber } from './helpers';
import { DOT_OVERLAY_SIZE_INCR, PERCENTAGE_BAR_DEFAULT_DEPTH } from './constants'; import { DOT_OVERLAY_SIZE_INCR, PERCENTAGE_BAR_DEFAULT_DEPTH } from './constants';
import { lightenDarkenColor } from './colors'; import { lightenDarkenColor } from './colors';


@@ -363,6 +363,8 @@ function makeHoriLine(y, label, x1, x2, options={}) {
} }


export function yLine(y, label, width, options={}) { export function yLine(y, label, width, options={}) {
if (!isValidNumber(y)) y = 0;

if(!options.pos) options.pos = 'left'; if(!options.pos) options.pos = 'left';
if(!options.offset) options.offset = 0; if(!options.offset) options.offset = 0;
if(!options.mode) options.mode = 'span'; if(!options.mode) options.mode = 'span';
@@ -391,6 +393,8 @@ export function yLine(y, label, width, options={}) {
} }


export function xLine(x, label, height, options={}) { export function xLine(x, label, height, options={}) {
if (!isValidNumber(x)) x = 0;

if(!options.pos) options.pos = 'bottom'; if(!options.pos) options.pos = 'bottom';
if(!options.offset) options.offset = 0; if(!options.offset) options.offset = 0;
if(!options.mode) options.mode = 'span'; if(!options.mode) options.mode = 'span';


Carregando…
Cancelar
Guardar