浏览代码

fix: set default translate to 0 if invalid

tags/v1.5.2
Shivam Mishra 4 年前
父节点
当前提交
773f93c414
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. +5
    -1
      src/js/utils/draw.js

+ 5
- 1
src/js/utils/draw.js 查看文件

@@ -1,5 +1,5 @@
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 { lightenDarkenColor } from './colors';

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

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

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

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

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


正在加载...
取消
保存