Skip to content

Commit c31ae08

Browse files
committed
add Geohash Field option to table data
1 parent e28dc59 commit c31ae08

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/data_formatter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,11 @@ export default class DataFormatter {
143143
let lowestValue = Number.MAX_VALUE;
144144

145145
tableData[0].forEach((datapoint) => {
146-
if (!datapoint.geohash) {
146+
if (!datapoint[this.ctrl.panel.tableGeohash]) {
147147
return;
148148
}
149149

150-
const encodedGeohash = datapoint.geohash;
150+
const encodedGeohash = datapoint[this.ctrl.panel.tableGeohash];
151151
const decodedGeohash = decodeGeoHash(encodedGeohash);
152152

153153
const dataValue = {

src/partials/editor.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ <h5 class="section-heading">Map Data Options</h5>
5858
<label class="gf-form-label width-12">Table Label Field</label>
5959
<input type="text" class="input-small gf-form-input width-10" ng-model="ctrl.panel.tableLabel" ng-change="ctrl.refresh()" ng-model-onblur />
6060
</div>
61+
<div class="gf-form" ng-show="ctrl.panel.locationData === 'table'">
62+
<label class="gf-form-label width-12">Geohash Field</label>
63+
<input type="text" class="input-small gf-form-input width-10" ng-model="ctrl.panel.tableGeohash" ng-change="ctrl.refresh()" ng-model-onblur />
64+
</div>
6165
<div class="gf-form" ng-show="ctrl.panel.locationData === 'geohash'">
6266
<label class="gf-form-label width-12">ES Metric Field</label>
6367
<input type="text" class="input-small gf-form-input width-10" ng-model="ctrl.panel.esMetric" ng-change="ctrl.refresh()" ng-model-onblur />

src/worldmap_ctrl.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ const panelDefaults = {
2727
decimals: 0,
2828
hideEmpty: false,
2929
hideZero: false,
30-
stickyLabels: false
30+
stickyLabels: false,
31+
tableGeohash: 'geohash'
3132
};
3233

3334
const mapCenters = {

0 commit comments

Comments
 (0)