Skip to content

Commit

Permalink
Merge pull request #16614 from susiwen8/16574
Browse files Browse the repository at this point in the history
fix(sanky):fallback to black if color were illegal
  • Loading branch information
pissang authored Mar 3, 2022
2 parents fdf5490 + c572d10 commit e785e61
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/visual/VisualMapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
VisualOptionUnit,
ParsedValue
} from '../util/types';
import { warn } from '../util/log';

const each = zrUtil.each;
const isObject = zrUtil.isObject;
Expand Down Expand Up @@ -693,7 +694,11 @@ function setVisualToOption(thisOption: VisualMappingInnerOption, visualArr: Visu
thisOption.visual = visualArr;
if (thisOption.type === 'color') {
thisOption.parsedVisual = zrUtil.map(visualArr, function (item: string) {
return zrColor.parse(item);
const color = zrColor.parse(item);
if (!color && __DEV__) {
warn(`'${item}' is an illegal color, fallback to '#000000'`, true);
}
return color || [0, 0, 0, 1];
});
}
return visualArr;
Expand Down

0 comments on commit e785e61

Please sign in to comment.