# Twitter analysis percentage distribution

**URL:** <https://discuss.elastic.co/t/twitter-analysis-percentage-distribution/152251>\
**Category:** Kibana\
**Created:** [October 12, 2018, 1:50pm UTC](https://discuss.elastic.co/t/twitter-analysis-percentage-distribution/152251 "2018-10-12T13:50:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![xenom](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xenom/32/36466_2.png) [@xenom](https://discuss.elastic.co/u/xenom)\
**Post date:** [October 12, 2018, 1:50pm UTC](https://discuss.elastic.co/t/twitter-analysis-percentage-distribution/152251/1 "2018-10-12T13:50:22Z")

</div>

Hello,

I am pushing a twitter stream in real time to my elastic stack after some treatment in python.  
Particularly a sentiment analysis which adds a field "sentiment" to each tweet.

It's a string with 3 possible values : Neutral / Positive / Negative.

Now I want to visualize the evolution of this field in percentage on a timeline. However I would like to keep the summed up distribution at each time.  
To illustrate, something like this :  
 ![](https://i.pinimg.com/originals/52/56/af/5256af33cbb2f831f8f8cdd62ab2ca07.png)

Do you have any clue ? Even with Timelion or VisualBuilder I can't use the field "sentiment" properly.

---

<div class="post-metadata">

**Author:** ![xenom](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xenom/32/36466_2.png) [@xenom](https://discuss.elastic.co/u/xenom)\
**Post date:** [October 22, 2018, 8:28am UTC](https://discuss.elastic.co/t/twitter-analysis-percentage-distribution/152251/2 "2018-10-22T08:28:48Z")

</div>

Hello ! Still did not find a solution. Any ideas ?

---

<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:** [October 23, 2018, 1:32am UTC](https://discuss.elastic.co/t/twitter-analysis-percentage-distribution/152251/3 "2018-10-23T01:32:09Z")

</div>

Sorry this got sort of lost in the shuffle! You should be able to use an Area Chart, using a "Date Histogram" X-Axis, a "Split Series" bucket using the "Terms" aggregation on the `sentiment` field, and finally switching over to "Metrics and Axes" to switch the "Y-Axis" mode to "percentage":

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

---

<div class="post-metadata">

**Author:** ![xenom](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xenom/32/36466_2.png) [@xenom](https://discuss.elastic.co/u/xenom)\
**Post date:** [October 23, 2018, 8:13am UTC](https://discuss.elastic.co/t/twitter-analysis-percentage-distribution/152251/4 "2018-10-23T08:13:29Z")

</div>

Hello, thanks it's working perfectly.

Now, I understand my date histogram is taking sample for the defined interval and calculating for each interval the resulting percentage.  
Is it possible to compute things differently by taking the previous values into account when calculating the percentage ? For example if I analyse one month with an interval of one day, I would like that day 4 percentage takes the previous day 1 2 and 3 into account. Is that possible ?

Thanks in advance

---

<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:** [November 20, 2018, 8:13am UTC](https://discuss.elastic.co/t/twitter-analysis-percentage-distribution/152251/5 "2018-11-20T08:13:30Z")

</div>

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