influxdata / influxdata/giraffe

GeoWidget: Tracks seem to be bound to field named 'table'

Open
#406 0 comments 0 reactions 1 assignee Claimed by @ivankudibal View on GitHub
kind/tech debt team/bonitoo
Dominant language
TypeScript
Stars
189
Forks
33
Avg merge
3d 15h
Merged PRs (30d)
4

Description

**Build**

Detected in PR 365 - Dubsky fork

```
commit 361b63bc55ac4989f17f03f33165d3070c7236b2
```
**Use Case**

I've extracted the data for tracks using the following query.

```javascript
import "experimental/geo"
from(bucket: "qa")
|> range(start: -2h)
|> filter(fn: (r) => r["_measurement"] == "voieGis" )
|> geo.toRows()
|> geo.asTracks(groupBy: ["ligne"], orderBy: ["_time"])
```

This returns records with the fields `[_time,_measurement,cl, ligne, nom, st, dur, mag, lat, lon]`. Note there is no field named "`table`". The results are stored in a `data` object passed as a property to a React component.

The track configuration is as follows.

```javascript
const config: Config = {
table: fromRows(data),
showAxes: false,
layers: [
{
type: 'geo',
lat: latitude,
lon: longitude,
zoom: 8,
allowPanAndZoom: true,
detectCoordinateFields: true,
layers: [
{
type: 'trackMap',
speed: 1000,
trackWidth: 4,
randomColors: true,
endStopMarkers: true,
endStopMarkerRadius: 4,
colors: undefined
},
],
tileServerConfiguration,
} as GeoLayerConfig,
],
}
```
**Expected Behavior**

I was expecting to find in the configuration a property that can be used to declare which field in the data object is to be used to organize the rendering of the tracks. In the current case I wanted to use 'ligne'. The tracks roughly follow railway lines.

**Actual Behavior**

Not finding a property to specify the structuring field I proceeded ahead. A single track was displayed moving through all data points.

To fix this I followed the storybook example and created a field named "table". The tracks were then rendered as expected.

```javascript

data.forEach(rec => {
rec.table = rec.ligne;
})
```

**Comment**
It would be nice if the required field can be declared in the configuration, instead of having to rely on a hard coded 'table' field.

**Screenshots**

_without the 'table' field_

![TracksWithoutTable01](https://user-images.githubusercontent.com/25881301/100873441-86c05f80-34a3-11eb-9ed9-0f0df02bae1f.png)

_with the 'table' field_ :+1: :

![TracksWithTable01](https://user-images.githubusercontent.com/25881301/100873510-9dff4d00-34a3-11eb-841e-b6da1651d167.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.