# TSVB Descending Order not working as expected

**URL:** <https://discuss.elastic.co/t/tsvb-descending-order-not-working-as-expected/200862>\
**Category:** Kibana\
**Created:** [September 24, 2019, 12:27pm UTC](https://discuss.elastic.co/t/tsvb-descending-order-not-working-as-expected/200862 "2019-09-24T12:27:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![willemdh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/willemdh/32/16922_2.png) [@willemdh](https://discuss.elastic.co/u/willemdh)\
**Post date:** [September 24, 2019, 12:27pm UTC](https://discuss.elastic.co/t/tsvb-descending-order-not-working-as-expected/200862/1 "2019-09-24T12:27:54Z")

</div>

Hello,

For some reason when I create 7.3.2 tsvb timeseries chart and select order by "Max of system.diksio.read.bytes", the legend is not sorted at all:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/c/fc19d286ee9e16781293c293edaa2debbf21849c.png)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/d/6/d611ce25eeeb78bbe744607b128d4a3ca7bb87b6.png)

Json export of the visualisation:

```
{"attributes":{"description":"","kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"},"title":"Elastic Beats Metricbeat System DiskIO Read Bytes Windows Disk Name Time Series","uiStateJSON":"{}","version":1,"visState":"{\"title\":\"Elastic Beats Metricbeat System DiskIO Read Bytes Windows Disk Name Time Series\",\"type\":\"metrics\",\"params\":{\"id\":\"61ca57f0-469d-11e7-af02-69e470af7417\",\"type\":\"timeseries\",\"series\":[{\"id\":\"61ca57f1-469d-11e7-af02-69e470af7417\",\"color\":\"#68BC00\",\"split_mode\":\"terms\",\"metrics\":[{\"id\":\"61ca57f2-469d-11e7-af02-69e470af7417\",\"type\":\"max\",\"field\":\"system.diskio.read.bytes\"},{\"unit\":\"\",\"id\":\"b4c50a50-dec0-11e9-8645-256c9a1c014d\",\"type\":\"derivative\",\"field\":\"61ca57f2-469d-11e7-af02-69e470af7417\"},{\"unit\":\"\",\"id\":\"ee8a5100-dec0-11e9-8645-256c9a1c014d\",\"type\":\"positive_only\",\"field\":\"b4c50a50-dec0-11e9-8645-256c9a1c014d\"}],\"separate_axis\":0,\"axis_position\":\"right\",\"formatter\":\"bytes\",\"chart_type\":\"line\",\"line_width\":1,\"point_size\":1,\"fill\":\"0.2\",\"stacked\":\"none\",\"label\":\"\",\"terms_field\":\"system.diskio.name\",\"terms_order_by\":\"61ca57f2-469d-11e7-af02-69e470af7417\",\"terms_size\":\"10\",\"terms_direction\":\"desc\"}],\"time_field\":\"@timestamp\",\"index_pattern\":\"metricbeat\",\"interval\":\"auto\",\"axis_position\":\"left\",\"axis_formatter\":\"number\",\"axis_scale\":\"normal\",\"show_legend\":1,\"show_grid\":1,\"default_index_pattern\":\"metricbeat\",\"default_timefield\":\"@timestamp\",\"filter\":{\"query\":\"event.dataset : \\\"system.diskio\\\" AND host.os.family : \\\"windows\\\"\",\"language\":\"kuery\"}},\"aggs\":[]}"},"id":"d1982970-dec3-11e9-8536-f91cecc85017","migrationVersion":{"visualization":"7.3.1"},"references":[],"type":"visualization","updated_at":"2019-09-24T12:07:02.791Z","version":"WzU1MDUsMV0="}~

```

I'm guessing the reason is that `system.diskio.read.bytes` is a incrementing counter or sth like that? Is there some way to make the sort work on the derivative instead of on the raw value?

Another issue I noted with this visualisation is that sometimes it looke like this:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/9/997e307ccb126ca87fd474b6a12a0cc8022d8b54.png)  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/8/a89f4af849ac9e4ef5b9368e32efbadd0d82cb44.png)

This seems to happen mostly on small time ranges. Is there any way to prevent this?

Tx

Willem

---

<div class="post-metadata">

**Author:** ![markov00](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/markov00/32/33316_2.png) [@markov00](https://discuss.elastic.co/u/markov00)\
**Post date:** [September 24, 2019, 1:55pm UTC](https://discuss.elastic.co/t/tsvb-descending-order-not-working-as-expected/200862/2 "2019-09-24T13:55:27Z")

</div>

Hi @willemdh  
can you please an issue here for the first problem (legend ordering)?[https://github.com/elastic/kibana/issues/new?template=Bug\_report.md](https://github.com/elastic/kibana/issues/new?template=Bug_report.md)  
Seems like a legit bug but It's better to track it down first.

Instead for the second issue, can you please describe a bit what is the desired output instead? Because it really depends on the nature of your data.

---

<div class="post-metadata">

**Author:** ![willemdh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/willemdh/32/16922_2.png) [@willemdh](https://discuss.elastic.co/u/willemdh)\
**Post date:** [September 24, 2019, 2:28pm UTC](https://discuss.elastic.co/t/tsvb-descending-order-not-working-as-expected/200862/3 "2019-09-24T14:28:04Z")

</div>

Hi Marco,

@markov00 Thanks for the fast answer. See [https://github.com/elastic/kibana/issues/46466](https://github.com/elastic/kibana/issues/46466). For the second issue, I'll try to explain with 2 visualisations:

1. Last 30 minutes range:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/c/1c49d1b082168dd68c0911ab0ec7909796a405f1.png)

1. Same visualisation, last 15 minutes range:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/c/3/c38141c5bf3429ea75fc35dd34d5870781e49d43.png)

Metrics are gathered every 10 seconds, so there is definitely data. Visualizing the same data in Grafana works perfectly..

Grtz

Willem

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 22, 2019, 2:28pm UTC](https://discuss.elastic.co/t/tsvb-descending-order-not-working-as-expected/200862/4 "2019-10-22T14:28:10Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
