prelert / kibana-swimlane-vis

Kibana swimlane visualization
Apache License 2.0
140 stars 41 forks source link

Lanes ordered alphabetically with option set to "No" when values are string with numeric values #30

Closed acommendador closed 7 years ago

acommendador commented 7 years ago

Using v5.5.0.

For example, the expected order is field 2000 then 1000

PUT test/test/1 { "field": "1000", "value": 1, "time": "2017-07-24T00:00:00" } PUT test/test/2 { "field": "2000", "value": 2, "time": "2017-07-24T00:00:00" }

image image

Changing the "View by" order does not seem to have an effect.

peteharverson commented 7 years ago

Thanks for reporting @acommendador. I have just pushed up a commit which should fix this.

This was happening because I was relying on the ordering of the 'view by' properties in the chart data object built by the visualization being the same as that returned by the elasticsearch aggregation. This assumption on object property order was not valid it appears if the 'view by' values were strings which could be parsed as integers.

Using the same test data as you supplied, with an extra document of

PUT test/test/3
{
"field": "101",
"value": 30,
"time": "2017-07-24T00:00:00"
}

I now get the expected behaviour, with sort lane option set to 'No': image

and with sort lane option set to 'Descending': image

Note for the secondary alphabetical lane ordering, I am now using numeric collation, such that "101" < "1000" < "2000"

This fix will be in the next build for v5.5.1.