How to plot median and 95th percentile within same cell?

Hi, I am struggling to wrap my brain around getting flux + Chronograf to visualize more than one series.

Eg, how can I get both the median and the 95th percentile as separate series, but plotted on the same chart?

This is the documentation page I’ve been referencing. For a single series, it works fine, but every attempt with multiple series has given an error :confused:

Edit: something equivalent to this
image

Line graphs in the InfluxDB 2.0 UI create a separate line for each table in your output data and only visualize values from the _value column. To visualize both in the same graph, you can create two separate streams and union them together:

data = from(bucket: "example-bucket")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(...)

median = data |> aggregateWindow(every: v.windowPeriod, fn: median) |> set(key: "aggType", value: "median")
percentile = data |> aggregateWindow(every: v.windowPeriod, fn: (tables=<-, column) => tables |> quantile(q: 0.95) |> set(key: "aggType", value: "percentile")

union(tables: [median, percentile]
2 Likes

Thanks for this , was exactly what I was after!

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