# Custom visualization in kibana

**URL:** <https://discuss.elastic.co/t/custom-visualization-in-kibana/41172>\
**Category:** Kibana\
**Created:** [February 8, 2016, 10:06am UTC](https://discuss.elastic.co/t/custom-visualization-in-kibana/41172 "2016-02-08T10:06:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Croos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/croos/32/29489_2.png) [@Croos](https://discuss.elastic.co/u/Croos)\
**Post date:** [February 8, 2016, 10:06am UTC](https://discuss.elastic.co/t/custom-visualization-in-kibana/41172/1 "2016-02-08T10:06:26Z")

</div>

Help me to visualize it on kibana.  
This is the call\_log data collection of the tele-callers of our company. The user is tele-callers. The mapping of my index is following:

```
"mappings": {
      "vicidial_log": {
        "_timestamp": {
          "enabled": true
        },
        "properties": {         
          "call_date": {
            "type": "date",
            "format": "yyyy-MM-dd HH:mm:ss"
          },
          "end_epoch": {
            "type": "integer"
          },
          "lead_id": {
            "type": "integer"
          },
          "length_in_sec": {
            "type": "integer"
          }, 
          "start_epoch": {
            "type": "integer"
          },
          "log_id": {
            "type": "string",
            "analyzer": "standard"
          },
          "user": {
            "type": "string",
            "analyzer": "standard"
          }
        }
      }
    }

```

I have attached the sample data, and expected visualization hear.

> hint:  
> Idle time of an employee in particular date is calculate by the following equation,  
> `idle_time=(max(end_epoch) - min(start_epoch)) - sum(length_in_sec)`

sample sql query:

```
SELECT user, 
       call_date, 
       sum(length_in_sec) as 'work_time', 
       (max(end_epoch)-min(start_epoch))-sum(length_in_sec) as 'idle_time' 
FROM vicidial_log 
WHERE date(call_date)='2016-01-12' 
GROUP BY user

```

 ![](https://us1.discourse-cdn.com/elastic/original/2X/a/a6da975b0c1a688fcde106c460f9d05e2dffd738.jpg)

---

<div class="post-metadata">

**Author:** ![spalger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spalger/32/14092_2.png) [@spalger](https://discuss.elastic.co/u/spalger)\
**Post date:** [February 8, 2016, 7:10pm UTC](https://discuss.elastic.co/t/custom-visualization-in-kibana/41172/2 "2016-02-08T19:10:36Z")

</div>

If you write the `work_time` and the `idle_time` to your elasticsearch documents this would be very simple. Alternatively you can create these fields with ["scripted fields"](https://www.elastic.co/guide/en/kibana/current/managing-fields.html#create-scripted-field).

---

<div class="post-metadata">

**Author:** ![Croos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/croos/32/29489_2.png) [@Croos](https://discuss.elastic.co/u/Croos)\
**Post date:** [February 8, 2016, 7:51pm UTC](https://discuss.elastic.co/t/custom-visualization-in-kibana/41172/3 "2016-02-08T19:51:33Z")

</div>

I think, you didn't get my point. Please see the hint and help me to script the function.

---

<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:** [July 6, 2017, 2:03pm UTC](https://discuss.elastic.co/t/custom-visualization-in-kibana/41172/4 "2017-07-06T14:03:06Z")

</div>


