123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- import * as zrUtil from 'zrender/lib/core/util.js';
- var each = zrUtil.each;
- export default function visualMapPreprocessor(option) {
- var visualMap = option && option.visualMap;
- if (!zrUtil.isArray(visualMap)) {
- visualMap = visualMap ? [visualMap] : [];
- }
- each(visualMap, function (opt) {
- if (!opt) {
- return;
- }
-
- if (has(opt, 'splitList') && !has(opt, 'pieces')) {
- opt.pieces = opt.splitList;
- delete opt.splitList;
- }
- var pieces = opt.pieces;
- if (pieces && zrUtil.isArray(pieces)) {
- each(pieces, function (piece) {
- if (zrUtil.isObject(piece)) {
- if (has(piece, 'start') && !has(piece, 'min')) {
- piece.min = piece.start;
- }
- if (has(piece, 'end') && !has(piece, 'max')) {
- piece.max = piece.end;
- }
- }
- });
- }
- });
- }
- function has(obj, name) {
- return obj && obj.hasOwnProperty && obj.hasOwnProperty(name);
- }
|