# -*- coding: utf-8 -*- """ Created on Tue Jun 30 13:32:43 2020 @author: ninjaac """ from node_red_data_collection import sentiment_data import json import plotly.express as px import plotly.graph_objects as go tweet_df,sentiment_df,emotion_df=sentiment_data.get_sentiment_data() fig_pie = px.pie(sentiment_df, values='sentiment', title='Sentiment of peoples', ) fig_pie.update_traces(textposition='inside', textinfo='percent+label') fig_pie.update_layout( margin={'l':5 ,'r':5 ,'b':5 ,'t':10,'pad':10}, plot_bgcolor='black', paper_bgcolor='black', height=150, ) fig_pie.show() # -*- coding: utf-8 -*- """
from tweetwrangling import tweets_analyse from node_red_data_collection import sentiment_data import json import plotly.express as px import plotly.graph_objects as go #data collection part__________________________________________________________ total_confirmed, sorted_confirmed, total_deaths, sorted_death, total_recovered, sorted_recovered, top_25_cities = tweets_analyse.get_data( ) time_series_df = tweets_analyse.time_series_creation() #read sentiment data sentiment_values, sentimet_names, emotion_value, emotion_name, future_sentiment_value, future_sentimet_names, total = sentiment_data.get_sentiment_data( ) colors = { 'background': 'black', } #total count of deatha and confirmed cases total = [total_confirmed, total_deaths, total_recovered] total_name = [ ' - Global confirmed', ' - Global Death', ' - Global Recovery' ] #sorted cases among the country #generate scrolabel data for death and confirm cases
def update_bar_graph(n): colors = { 'backgroud': "black", 'text': 'gray', } print('hello bar emotion updated') sentiment_values, sentimet_names, emotion_value, emotion_name, future_sentiment_value, future_sentimet_names, total = sentiment_data.get_sentiment_data( ) return generate_bar_graph(emotion_value, emotion_name, colors)
def update_pie_graph(n): colors = { 'backgroud': "black", 'text': 'gray', } print("hello") sentiment_values, sentimet_names, emotion_value, emotion_name, future_sentiment_value, future_sentimet_names, total = sentiment_data.get_sentiment_data( ) return generate_pie_sentimnet_graph(sentiment_values, sentimet_names, colors)