# Pie chart from time range

**URL:** https://discuss.elastic.co/t/pie-chart-from-time-range/290545
**Category:** Kibana
**Created:** [November 30, 2021, 10:16am UTC](https://discuss.elastic.co/t/pie-chart-from-time-range/290545 "2021-11-30T10:16:49Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![franckfct](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/franckfct/32/81235_2.png) [@franckfct](https://discuss.elastic.co/u/franckfct)
#### Post date: [November 30, 2021, 10:16am UTC](https://discuss.elastic.co/t/pie-chart-from-time-range/290545/1 "2021-11-30T10:16:50Z")

</div>

Hi,

I have this kind of log to monitor the availability of my application:

```auto
Status,Start,End
Unavailable,17-03-2020 12:10:32,17-03-2020 12:14:32
Available,17-03-2020 12:15:32,26-03-2020 12:31:25
Unavailable,26-03-2020 12:32:25,26-03-2020 12:54:25
Available,26-03-2020 12:55:25,27-08-2020 12:21:15
Unavailable,27-08-2020 12:22:15,27-08-2020 12:26:15
Unavailable,27-08-2020 12:30:20,27-08-2020 12:41:20
Available,27-08-2020 12:42:20,26-01-2021 12:55:14
Unavailable,26-01-2021 12:56:14,26-01-2021 12:59:14
Unavailable,26-01-2021 13:01:56,26-01-2021 13:07:56
[...]

```

Is it possible to make a pie chart ( or other thing) in order to see the availability of my application over time.

Start and end, are already in 'date' format.

Thanks

---

<div class="post-metadata">

### Author: ![cheiligers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cheiligers/32/73114_2.png) [@cheiligers](https://discuss.elastic.co/u/cheiligers)
#### Post date: [November 30, 2021, 9:42pm UTC](https://discuss.elastic.co/t/pie-chart-from-time-range/290545/2 "2021-11-30T21:42:00Z")

</div>

@franckfct Your data is fairly straight forward and you should be able to use a number of different visualizations. Lens has a nifty feature that gives suggestions on what charts to use for your data type and shape. I suggest trying that out. Here are a few links to get you started:

1. [Lens overview](https://www.elastic.co/kibana/kibana-lens)
2. [Lens blog post](https://www.elastic.co/blog/introducing-kibana-lens)
3. [Getting started with Lens tutorial](https://www.elastic.co/guide/en/kibana/current/lens.html)

---

<div class="post-metadata">

### Author: ![franckfct](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/franckfct/32/81235_2.png) [@franckfct](https://discuss.elastic.co/u/franckfct)
#### Post date: [December 2, 2021, 9:46am UTC](https://discuss.elastic.co/t/pie-chart-from-time-range/290545/3 "2021-12-02T09:46:53Z")

</div>

Thanks,

I know Lens and i made a lot of graph with it, but in this case, Lens just count the number of status and not the duration between two date.

---

<div class="post-metadata">

### Author: ![cheiligers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cheiligers/32/73114_2.png) [@cheiligers](https://discuss.elastic.co/u/cheiligers)
#### Post date: [December 2, 2021, 2:41pm UTC](https://discuss.elastic.co/t/pie-chart-from-time-range/290545/4 "2021-12-02T14:41:22Z")

</div>

Lens supports a number of modifications to your data. Try one of these options:  
[formulas](https://www.elastic.co/guide/en/kibana/7.15/lens.html#lens-formulas)  
[time-shift](https://www.elastic.co/guide/en/kibana/7.15/lens.html#compare-data-with-time-offsets)  
[filters](https://www.elastic.co/guide/en/kibana/7.15/lens.html#filter-the-data)

Then there's always the option of using [runtime fields](https://www.elastic.co/guide/en/elasticsearch/reference/current/runtime-search-request.html#runtime-search-request) to get your data into a shape you want to visualize.

---

<div class="post-metadata">

### Author: ![Marco\_Liberati](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marco_liberati/32/82953_2.png) [@Marco\_Liberati](https://discuss.elastic.co/u/Marco_Liberati)
#### Post date: [December 3, 2021, 2:48pm UTC](https://discuss.elastic.co/t/pie-chart-from-time-range/290545/5 "2021-12-03T14:48:21Z")

</div>

Hi @franckfct

What you want to visualize from the data above?  
You talk about pie chart, so probably you want to see a "duration" chart about Availability vs Unavailability?

If so you could create a new runtime field to compute the duration of each record ( `end - start` ) and then use Lens as suggested by @cheiligers to generate the visualization.

---

<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: [December 31, 2021, 2:48pm UTC](https://discuss.elastic.co/t/pie-chart-from-time-range/290545/6 "2021-12-31T14:48:28Z")

</div>

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