(this: MapSeries, option: MapSeriesOption)
| 132 | |
| 133 | |
| 134 | getInitialData(this: MapSeries, option: MapSeriesOption): SeriesData { |
| 135 | const data = createSeriesDataSimply(this, { |
| 136 | coordDimensions: ['value'], |
| 137 | encodeDefaulter: zrUtil.curry(makeSeriesEncodeForNameBased, this) |
| 138 | }); |
| 139 | const dataNameIndexMap = zrUtil.createHashMap<number>(); |
| 140 | const toAppendItems: MapDataItemOption[] = []; |
| 141 | |
| 142 | for (let i = 0, len = data.count(); i < len; i++) { |
| 143 | const name = data.getName(i); |
| 144 | dataNameIndexMap.set(name, i); |
| 145 | } |
| 146 | |
| 147 | const geoSource = geoSourceManager.load(this.getMapType(), this.option.nameMap, this.option.nameProperty); |
| 148 | zrUtil.each(geoSource.regions, function (region) { |
| 149 | const name = region.name; |
| 150 | const dataNameIdx = dataNameIndexMap.get(name); |
| 151 | // apply specified echarts style in GeoJSON data |
| 152 | const specifiedGeoJSONRegionStyle = (region as GeoJSONRegion).properties |
| 153 | && (region as GeoJSONRegion).properties.echartsStyle; |
| 154 | let dataItem: MapDataItemOption; |
| 155 | if (dataNameIdx == null) { |
| 156 | dataItem = { name: name }; |
| 157 | toAppendItems.push(dataItem); |
| 158 | } |
| 159 | else { |
| 160 | dataItem = data.getRawDataItem(dataNameIdx) as MapDataItemOption; |
| 161 | } |
| 162 | specifiedGeoJSONRegionStyle && zrUtil.merge(dataItem, specifiedGeoJSONRegionStyle); |
| 163 | }); |
| 164 | |
| 165 | // Complete data with missing regions. The consequent processes (like visual |
| 166 | // map and render) can not be performed without a "full data". For example, |
| 167 | // find `dataIndex` by name. |
| 168 | data.appendData(toAppendItems); |
| 169 | |
| 170 | return data; |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * If no host geo model, return null, which means using a |
nothing calls this directly
no test coverage detected