vap-visual
Advanced tools
Comparing version 0.1.2 to 0.1.3
{ | ||
"name": "vap-visual", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "vap-visual - A Visual FrameWork base on d3 & lodash", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -107,2 +107,8 @@ "use strict"; | ||
}); | ||
if (conf.extIcons && conf.extIcons.length) { | ||
conf.extIcons.map(function (item) { | ||
_this.ALL_AREAS.push({ id: item.id, name: item.name }); | ||
_this.centerMap.set(item.name, item.pos); | ||
}); | ||
} | ||
} | ||
@@ -145,2 +151,3 @@ default_1.prototype.has = function (areaName) { | ||
default_1.prototype.translate = function (name, id) { | ||
// console.log(name,id) | ||
return this.areaTranslate(name, id); | ||
@@ -147,0 +154,0 @@ }; |
@@ -36,2 +36,5 @@ "use strict"; | ||
} | ||
if (this.props.lineConf.speed) { | ||
this.speed = this.props.lineConf.speed; | ||
} | ||
} | ||
@@ -41,3 +44,2 @@ //添加一个区域到另外一个区域的线条组 | ||
var _this = this; | ||
console.log(arr); | ||
var _a = this.props.lineConf, sourceField = _a.sourceField, targetField = _a.targetField; | ||
@@ -44,0 +46,0 @@ var data = _.filter(arr, function (item) { |
@@ -47,3 +47,3 @@ "use strict"; | ||
default_1.prototype.init = function () { | ||
console.log('combine map init '); | ||
// console.log('combine map init ') | ||
_super.prototype.init.call(this); | ||
@@ -58,3 +58,3 @@ if (_.has(this.props, 'lineConf')) { | ||
var _this = this; | ||
console.log('statrt set'); | ||
// console.log('statrt set') | ||
var needRebuid = false; | ||
@@ -78,12 +78,12 @@ this.__need_rebuild.map(function (key) { | ||
} | ||
console.log('statrt set2'); | ||
// console.log('statrt set2') | ||
if (util_1.default.isEqArray(this.props.data, conf.data)) { | ||
console.log('statrt set5'); | ||
// console.log('statrt set5') | ||
this.props = _.extend(this.props, conf); | ||
this.update(this.sort(conf.data)); | ||
} | ||
console.log('statrt set3'); | ||
// console.log('statrt set3') | ||
if (util_1.default.isEqArray(this.props.lineData, conf.lineData)) { | ||
console.log('statrt set4'); | ||
console.log(conf.lineData); | ||
// console.log('statrt set4') | ||
// console.log(conf.lineData) | ||
this.props = _.extend(this.props, conf); | ||
@@ -95,3 +95,2 @@ this.updateLine(); | ||
if (this.lines != null) { | ||
console.log('fdsaf'); | ||
this.lines.setData(this.props.lineData); | ||
@@ -98,0 +97,0 @@ } |
@@ -284,3 +284,3 @@ "use strict"; | ||
var isDiffData = false; | ||
console.log('Set Options'); | ||
// console.log('Set Options') | ||
_.keys(conf).map(function (key) { | ||
@@ -300,3 +300,3 @@ // if (key == 'data') { | ||
}); | ||
console.log('Diff Result ', isDiff); | ||
// console.log('Diff Result ', isDiff) | ||
if (!isDiff) { | ||
@@ -303,0 +303,0 @@ // if (isDiffData) { |
import { VALUE_FORMAT, Grid } from '../interface'; | ||
export declare type ExtIcon = { | ||
/** | ||
* 地区编码 | ||
*/ | ||
id: string; | ||
/** | ||
* 地区名称(不会被转义) | ||
*/ | ||
name: string; | ||
icon: string; | ||
/** | ||
* 坐标 | ||
*/ | ||
pos: [number, number]; | ||
/** | ||
* 图标 | ||
*/ | ||
icon?: string; | ||
/** | ||
* 样式设置 | ||
*/ | ||
className?: string; | ||
@@ -7,0 +23,0 @@ }; |
@@ -32,2 +32,8 @@ "use strict"; | ||
var util_1 = require("../../util"); | ||
var ICON = { | ||
default: 'M-0.962-11.959c-5.806,0.49-9.935,5.551-8.871,10.728C-9.373,0.997-8,2.814-5.817,5.304c1.072,1.224,3.255,4.214,4.62,6.117 c0.559,0.778,1.821,0.771,2.369-0.014C2.453,9.572,4.817,6.367,5.813,5.3C8.696,2.218,10,0.281,10-2.973 C10-8.247,4.992-12.46-0.962-11.959z M0,1.21c-2.501,0-4.524-1.828-4.524-4.083c0-2.256,2.026-4.084,4.524-4.084 S4.525-5.13,4.525-2.874C4.525-0.621,2.498,1.21,0,1.21z', | ||
ga: 'M9.946-5.82c0,0.12,1.355,13.38-9.549,17.76L0.28,12h-0.59l-0.118-0.06C-11.331,7.56-9.976-5.7-9.917-5.82l0.059-0.54h0.531 c0.235,0,2.062-0.18,2.298-2.52L-6.97-9.3l0.354-0.18c5.069-1.98,6.071-2.34,6.307-2.46L-0.191-12h0.176c0.177,0,0.177,0,6.661,2.46 l0.354,0.18l0.059,0.42c0.295,2.46,2.239,2.58,2.298,2.58h0.531L9.946-5.82z M-0.015-7.86L-2.019-3.6l-4.538,0.72l3.3,3.36 l-0.766,4.74L0.044,3l4.067,2.22L3.345,0.48l3.301-3.36L2.107-3.6L-0.015-7.86z', | ||
question: 'M0-12c-6.627,0-12,5.373-12,12s5.373,12,12,12S12,6.627,12,0S6.627-12,0-12z M0.291,6.197C0,6.474-0.357,6.606-0.779,6.606 c-0.423,0-0.78-0.132-1.07-0.409c-0.291-0.278-0.436-0.595-0.436-0.965c0-0.383,0.145-0.7,0.436-0.978s0.647-0.41,1.07-0.41 c0.41,0,0.779,0.146,1.07,0.41c0.304,0.264,0.45,0.595,0.45,0.978C0.74,5.602,0.582,5.919,0.291,6.197z M3.145-1.638 c-0.291,0.528-0.78,1.083-1.48,1.651C1.083,0.476,0.7,0.845,0.542,1.11C0.383,1.374,0.304,1.705,0.304,2.074v0.568h-2.18v-0.78 c0-0.595,0.106-1.083,0.317-1.506c0.211-0.423,0.582-0.832,1.083-1.255c0.582-0.476,0.964-0.872,1.163-1.176 c0.198-0.304,0.291-0.634,0.291-0.991c0-0.41-0.132-0.727-0.423-0.978c-0.291-0.251-0.7-0.37-1.229-0.37 c-1.044,0-1.995,0.396-2.894,1.163v-2.537c0.991-0.542,2.035-0.819,3.158-0.819c1.269,0,2.246,0.291,2.946,0.872 c0.7,0.568,1.044,1.361,1.031,2.352C3.567-2.761,3.435-2.167,3.145-1.638L3.145-1.638z', | ||
star: 'M3.708-4.102L12-2.835L6.001,3.312l1.418,8.685L0.001,7.898L-7.414,12L-6,3.315l-6-6.149l8.291-1.267L-0.001-12L3.708-4.102 z' | ||
}; | ||
var default_1 = /** @class */ (function (_super) { | ||
@@ -68,15 +74,48 @@ __extends(default_1, _super); | ||
this.ROOT.classed('_map_show_name', this.props.showName); | ||
var areas = this.ROOT.selectAll('g._item').data(this.GEO.data().features); | ||
console.log(this.GEO.data().features); | ||
var areas = this.ROOT.selectAll('g._item').data(_.concat(this.GEO.data().features, this.props.extIcons)); | ||
this.GROUP = areas.enter() | ||
.append('g') | ||
.attr('class', function (d, i) { return _this.initClassName + ' _item_9'; }) | ||
.attr('id', function (d) { return 'area-' + d.properties.id; }); | ||
.attr('id', function (d) { return "area-" + (d.properties ? d.properties.id : d.name); }); | ||
var path = d3.geoPath().projection(this.projection); | ||
this.GROUP.append('path').attr('d', path); | ||
this.GROUP.append('path').attr('d', function (d) { | ||
if (d.properties) { | ||
return path(d); | ||
} | ||
if (!_.has(d, 'icon')) { | ||
return ICON.default; | ||
} | ||
if (_.has(ICON, d.icon)) { | ||
return ICON[d.icon]; | ||
} | ||
return d.icon; | ||
}).attr('style', function (d) { | ||
if (d.properties) { | ||
return ''; | ||
} | ||
var tran = _this.projection(d.pos); | ||
return "transform:translate(" + (tran[0]) + 'px,' + (tran[1]) + 'px);'; | ||
}); | ||
var pathbkg = d3.geoPath().projection(this.projectionBkg); | ||
this.EXT_TOP.append('path').datum(this.GEO.merge()).attr('d', pathbkg); | ||
this.GROUP.append('text') | ||
.attr('x', function (d) { return _this.projection(d.properties.cp)[0]; }) | ||
.attr('y', function (d) { return _this.projection(d.properties.cp)[1]; }) | ||
.text(function (d) { return _this.GEO.translate(d.properties.name, d.properties.id); }); | ||
.attr('x', function (d) { | ||
if (d.properties) { | ||
return _this.projection(d.properties.cp)[0]; | ||
} | ||
return _this.projection(d.pos)[0]; | ||
}) | ||
.attr('y', function (d) { | ||
if (d.properties) { | ||
return _this.projection(d.properties.cp)[1]; | ||
} | ||
return _this.projection(d.pos)[1] + 20; | ||
}) | ||
.text(function (d) { | ||
if (d.properties) { | ||
return _this.GEO.translate(d.properties.name, d.properties.id); | ||
} | ||
return d.name; | ||
}); | ||
this.GROUP.on('mouseover', function (d, i) { | ||
@@ -87,3 +126,2 @@ var _a; | ||
} | ||
var _b = d.properties, id = _b.id, name = _b.name; | ||
if (!_this._data_load) { | ||
@@ -95,2 +133,11 @@ return; | ||
} | ||
var id = '', name = ''; | ||
if (d.properties) { | ||
id = d.properties.id; | ||
name = d.properties.name; | ||
} | ||
else { | ||
id = d.id; | ||
name = d.name; | ||
} | ||
var data = _.find(_this.DATA, { __name: name }); | ||
@@ -111,3 +158,14 @@ if (data == undefined) { | ||
var _a; | ||
var _b = d.properties, id = _b.id, name = _b.name; | ||
var id = '', name = ''; | ||
var cp = [0, 0]; | ||
if (d.properties) { | ||
id = d.properties.id; | ||
name = d.properties.name; | ||
cp = d.properties.cp; | ||
} | ||
else { | ||
id = d.id; | ||
name = d.name; | ||
cp = d.pos; | ||
} | ||
var data = _.find(_this.DATA, { __name: name }); | ||
@@ -130,4 +188,4 @@ if (data == undefined) { | ||
.attr('class', '_map_selected_point') | ||
.attr('cx', _this.projection(d.properties.cp)[0]) | ||
.attr('cy', _this.projection(d.properties.cp)[1]) | ||
.attr('cx', _this.projection(cp)[0]) | ||
.attr('cy', _this.projection(cp)[1]) | ||
.attr('r', 10) | ||
@@ -134,0 +192,0 @@ .append('animate') |
386577
9435