I am currently graphing the sentiment values of tweets over a span of 10 years. The CSV file contains three columns as outlined below.
Successfully, I managed to plot each value by date. However, upon attempting to create an area graph, I encountered an issue where each date had multiple values.
This complication arises from each data point being derived from a single tweet, resulting in one x point having multiple y values.
In order to address this dilemma, I attempted to choose the quartile value of each date or select the largest or smallest y value for clarity. An example is provided below.
https://i.sstatic.net/xxLQi.png
For instance, January 8 exhibits multiple y values (textblob).
My objective is to generate an area graph while selecting either the largest value or the 2nd quartile value of each point.
How can I effectively pick the points?
The intention is to utilize the points in the following code as x/y coordinates for line or area graphs.
function* vlinedrawing(data){
for(let i;i<data.length;i++){
if( i%500==0) yield svg.node();
let px = margin+xscale(data[i].date)
let py = height-margin-yscale(data[i].vader)
paths.append('path')
.attr('x',px)
.attr('y',py)
}
yield svg.node()
}
The complete code can be found at the following link.
https://jsfiddle.net/soonk/uh5djax4/2/
Thank you in advance. ( The reason why it is a generator is that I'm going to visualize the graph in animated way)