in ui/src/app/data-explorer-shared/components/charts/map/map-widget.component.ts [197:265]
makeLayers(spQueryResult: SpQueryResult) {
this.layers = [];
if (spQueryResult && spQueryResult.total > 0) {
for (let i = 0; i <= spQueryResult.allDataSeries.length - 1; i++) {
const result = spQueryResult.allDataSeries[i];
const latitudeIndex = this.getColumnIndex(
this.dataExplorerWidget.visualizationConfig
.selectedLatitudeProperty,
spQueryResult,
);
const longitudeIndex = this.getColumnIndex(
this.dataExplorerWidget.visualizationConfig
.selectedLongitudeProperty,
spQueryResult,
);
const latitudeValues = this.transform(
result.rows,
latitudeIndex,
);
const longitudeValues = this.transform(
result.rows,
longitudeIndex,
);
if (
this.dataExplorerWidget.visualizationConfig
.selectedMarkerOrTrace === 'marker'
) {
latitudeValues.map((latitude, index) => {
const longitude = longitudeValues[index];
const tmpMarker = this.makeMarker(
[latitude, longitude],
this.dataExplorerWidget.visualizationConfig
.selectedMarkerType,
);
let text = `<b>Time:</b>${new Date(result.rows[index][0])}<br/>`;
this.dataExplorerWidget.visualizationConfig.selectedToolTipContent.forEach(
item => {
const subIndex = this.getColumnIndex(
item,
spQueryResult,
);
text = text.concat(
`<b>${item.fullDbName}:</b> ${result.rows[index][subIndex]}<br/>`,
);
},
);
const content: Content = text;
tmpMarker.bindTooltip(content);
this.layers.push(tmpMarker);
});
} else {
const coordinates = [];
latitudeValues.map((latitude, index) => {
coordinates.push([latitude, longitudeValues[index]]);
});
const poly = polyline(coordinates, { color: 'red' });
this.layers.push(poly);
}
}
}
}