|
|
@ -15,12 +15,37 @@ |
|
|
|
dom.style.width = document.body.clientWidth + "px"; |
|
|
|
dom.style.width = document.body.clientWidth + "px"; |
|
|
|
dom.style.height = document.body.clientHeight + "px"; |
|
|
|
dom.style.height = document.body.clientHeight + "px"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { |
|
|
|
|
|
|
|
// 数据,若横纵轴多指标时图表属性有维度字段,dataModels 为以图表属性为分组的多组数据
|
|
|
|
|
|
|
|
dataModels, |
|
|
|
|
|
|
|
// 横纵轴拖入字段的维度 id
|
|
|
|
|
|
|
|
dataMapping, |
|
|
|
|
|
|
|
// 图表属性拖入字段的维度 id
|
|
|
|
|
|
|
|
chartAttrMapping, |
|
|
|
|
|
|
|
// 图表点击值
|
|
|
|
|
|
|
|
clicked |
|
|
|
|
|
|
|
} = data; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { |
|
|
|
|
|
|
|
// 组件 id
|
|
|
|
|
|
|
|
widgetId, |
|
|
|
|
|
|
|
// 全局样式中图表最终样式
|
|
|
|
|
|
|
|
globalStyles, |
|
|
|
|
|
|
|
// 图表属性配置所选值
|
|
|
|
|
|
|
|
chartAttr, |
|
|
|
|
|
|
|
// 图表样式配置所选值
|
|
|
|
|
|
|
|
chartStyle, |
|
|
|
|
|
|
|
// 图标属性中使用形状时的图标映射
|
|
|
|
|
|
|
|
symbolIconMap, |
|
|
|
|
|
|
|
// 自定义保存的值(saveSessionCallback)
|
|
|
|
|
|
|
|
customConfig |
|
|
|
|
|
|
|
} = config; |
|
|
|
|
|
|
|
|
|
|
|
// 获取配置项
|
|
|
|
// 获取配置项
|
|
|
|
const mapAttribute = config["chartStyle"]["mapProp"]["value"]; |
|
|
|
const mapAttribute = chartStyle["mapProp"]["value"]; |
|
|
|
|
|
|
|
|
|
|
|
// 地图组件初始化
|
|
|
|
// 地图组件初始化
|
|
|
|
let map; |
|
|
|
let map; |
|
|
|
let customConfig = config.customConfig; |
|
|
|
|
|
|
|
if (customConfig != null && JSON.stringify(customConfig).length > 2) { |
|
|
|
if (customConfig != null && JSON.stringify(customConfig).length > 2) { |
|
|
|
// 读取保存的配置
|
|
|
|
// 读取保存的配置
|
|
|
|
map = new AMap.Map(dom, { |
|
|
|
map = new AMap.Map(dom, { |
|
|
@ -41,7 +66,7 @@ |
|
|
|
map.setMapStyle(styleName); |
|
|
|
map.setMapStyle(styleName); |
|
|
|
|
|
|
|
|
|
|
|
// 获取全部的经纬度点数据
|
|
|
|
// 获取全部的经纬度点数据
|
|
|
|
const points = _getAllPoint(data.dataMapping, data.dataModels[0]); |
|
|
|
const points = _getAllPoint(dataMapping, dataModels[0]); |
|
|
|
|
|
|
|
|
|
|
|
if (points != null) { |
|
|
|
if (points != null) { |
|
|
|
// 创建聚合点图层
|
|
|
|
// 创建聚合点图层
|
|
|
@ -68,7 +93,6 @@ |
|
|
|
saveSessionCallback(conf); |
|
|
|
saveSessionCallback(conf); |
|
|
|
extensionCallBack('refresh'); |
|
|
|
extensionCallBack('refresh'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 自定义聚合点样式 |
|
|
|
* 自定义聚合点样式 |
|
|
@ -120,6 +144,42 @@ |
|
|
|
var offset = new AMap.Pixel(-9, -9); |
|
|
|
var offset = new AMap.Pixel(-9, -9); |
|
|
|
context.marker.setContent(content) |
|
|
|
context.marker.setContent(content) |
|
|
|
context.marker.setOffset(offset) |
|
|
|
context.marker.setOffset(offset) |
|
|
|
|
|
|
|
let datum = context.data[0]; |
|
|
|
|
|
|
|
let id = datum.idId; |
|
|
|
|
|
|
|
const val = [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
dId: datum.idId, |
|
|
|
|
|
|
|
text: datum.idVal, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// dId: datum.lngId,
|
|
|
|
|
|
|
|
// text: datum.lngVal,
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// dId: datum.latId,
|
|
|
|
|
|
|
|
// text: datum.latVal,
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* dId: 当前维度的Id |
|
|
|
|
|
|
|
* value: 当前维度和之前维度的id及对应值 (不是全部的维度信息!) |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
const currentClicked = { |
|
|
|
|
|
|
|
dId: id, |
|
|
|
|
|
|
|
value: val |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context.marker.on('click', ev => { |
|
|
|
|
|
|
|
debugger; |
|
|
|
|
|
|
|
// 触发联动
|
|
|
|
|
|
|
|
extensionCallBack( |
|
|
|
|
|
|
|
'click', |
|
|
|
|
|
|
|
currentClicked |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -130,8 +190,8 @@ |
|
|
|
* @private |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function _getAllPoint(dataMapping, dataModel) { |
|
|
|
function _getAllPoint(dataMapping, dataModel) { |
|
|
|
let lngId = dataMapping['lat']; |
|
|
|
let lngId = dataMapping['lng']; |
|
|
|
let latId = dataMapping['lng']; |
|
|
|
let latId = dataMapping['lat']; |
|
|
|
|
|
|
|
|
|
|
|
let files = dataModel.fields; |
|
|
|
let files = dataModel.fields; |
|
|
|
let rowCount = dataModel.rowCount |
|
|
|
let rowCount = dataModel.rowCount |
|
|
@ -139,14 +199,16 @@ |
|
|
|
|
|
|
|
|
|
|
|
let lngIndex; |
|
|
|
let lngIndex; |
|
|
|
let latIndex; |
|
|
|
let latIndex; |
|
|
|
|
|
|
|
let idIndex; |
|
|
|
|
|
|
|
|
|
|
|
// demo这里没有考虑多维度多指标的情况,具体根据实际情况进行修改
|
|
|
|
// demo这里没有考虑多维度多指标的情况,具体根据实际情况进行修改
|
|
|
|
files.forEach((item, index) => { |
|
|
|
files.forEach((item, index) => { |
|
|
|
if (lngId.indexOf(item.id) >= 0) { |
|
|
|
if (lngId.indexOf(item.id) >= 0) { |
|
|
|
lngIndex = index; |
|
|
|
lngIndex = index; |
|
|
|
} |
|
|
|
} else if (latId.indexOf(item.id) >= 0) { |
|
|
|
if (latId.indexOf(item.id) >= 0) { |
|
|
|
|
|
|
|
latIndex = index; |
|
|
|
latIndex = index; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
idIndex = index; |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
@ -154,6 +216,12 @@ |
|
|
|
for (let i = 0; i < rowCount; i++) { |
|
|
|
for (let i = 0; i < rowCount; i++) { |
|
|
|
points.push({ |
|
|
|
points.push({ |
|
|
|
lnglat: [colData[lngIndex][i], colData[latIndex][i]], |
|
|
|
lnglat: [colData[lngIndex][i], colData[latIndex][i]], |
|
|
|
|
|
|
|
lngId: files[lngIndex].id, |
|
|
|
|
|
|
|
latId: files[latIndex].id, |
|
|
|
|
|
|
|
idId: files[idIndex].id, |
|
|
|
|
|
|
|
lngVal: colData[lngIndex][i], |
|
|
|
|
|
|
|
latVal: colData[latIndex][i], |
|
|
|
|
|
|
|
idVal: colData[idIndex][i], |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|