123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- var _config = require("../../config");
- var __DEV__ = _config.__DEV__;
- var echarts = require("../../echarts");
- var zrUtil = require("zrender/lib/core/util");
- var visualSolution = require("../../visual/visualSolution");
- var Model = require("../../model/Model");
- var DEFAULT_OUT_OF_BRUSH_COLOR = ['#ddd'];
- var BrushModel = echarts.extendComponentModel({
- type: 'brush',
- dependencies: ['geo', 'grid', 'xAxis', 'yAxis', 'parallel', 'series'],
-
- defaultOption: {
-
-
- toolbox: null,
-
- brushLink: null,
-
-
- seriesIndex: 'all',
-
- geoIndex: null,
-
- xAxisIndex: null,
- yAxisIndex: null,
- brushType: 'rect',
-
- brushMode: 'single',
-
- transformable: true,
-
- brushStyle: {
-
- borderWidth: 1,
- color: 'rgba(120,140,180,0.3)',
- borderColor: 'rgba(120,140,180,0.8)'
- },
- throttleType: 'fixRate',
-
-
- throttleDelay: 0,
-
-
-
- removeOnClick: true,
- z: 10000
- },
-
- areas: [],
-
- brushType: null,
-
- brushOption: {},
-
- coordInfoList: [],
- optionUpdated: function (newOption, isInit) {
- var thisOption = this.option;
- !isInit && visualSolution.replaceVisualOption(thisOption, newOption, ['inBrush', 'outOfBrush']);
- var inBrush = thisOption.inBrush = thisOption.inBrush || {};
- thisOption.outOfBrush = thisOption.outOfBrush || {
- color: DEFAULT_OUT_OF_BRUSH_COLOR
- };
- if (!inBrush.hasOwnProperty('liftZ')) {
-
-
- inBrush.liftZ = 5;
- }
- },
-
- setAreas: function (areas) {
-
-
-
- if (!areas) {
- return;
- }
- this.areas = zrUtil.map(areas, function (area) {
- return generateBrushOption(this.option, area);
- }, this);
- },
-
- setBrushOption: function (brushOption) {
- this.brushOption = generateBrushOption(this.option, brushOption);
- this.brushType = this.brushOption.brushType;
- }
- });
- function generateBrushOption(option, brushOption) {
- return zrUtil.merge({
- brushType: option.brushType,
- brushMode: option.brushMode,
- transformable: option.transformable,
- brushStyle: new Model(option.brushStyle).getItemStyle(),
- removeOnClick: option.removeOnClick,
- z: option.z
- }, brushOption, true);
- }
- var _default = BrushModel;
- module.exports = _default;
|