pie chart: i expect dynamic visualise , please click and check my charts and how to visualise dynamically . I have created charts dynamically in python where i have to insert in HTML page directly and view the charts dynamically but i am unable to insert in my HTML page
I can show the charts in HTML page as image where i am not able to visualise in dynamic.
I want to know the code in HTML regarding the plots and graphs to be directly inserted in my HTML page from the python code or any other way to visualise the plots and graphs dynamically in User interface`
<h6 class="m-1" >Purchase Stats</h6>
<div>
<img src="{{ pie }}" width="380" height="333">
</div>
data=pd.read_csv("sales_data.csv")
df = pd.DataFrame(data)
filtered_data=data[['quantity','states_x']]
filtered_data1=data[['product category']]
#finding the sales by region
sales_by_region = df.groupby('states_x').size()
sales_by_region.head()
filtered_data.states_x.value_counts()[:14].plot(kind='bar')
plt.title('Top 15 Statewise Sales')
plt.xlabel('Region')
plt.ylabel('Total Sales')
plt.tight_layout()
plt.savefig('static/images/bar.png')
### Rendering Plot in Html
##figfile = BytesIO()
#plt.savefig(figfile, format='png')
bar = os.path.join(app.config['UPLOAD_FOLDER'], 'regionwise_sales.png')
return render_template('index.html',pie = pie )
`
