1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- var zrUtil = require("zrender/lib/core/util");
- var each = zrUtil.each;
- function _default(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);
- }
- module.exports = _default;
|