My plotly is not working properly. I am trying to render the graph in html, but it keeps showing the text rather than the graph itself.
Below is an extract of the code written in the 'app.py' file - using the Flask microframework.
k = plotly.offline.plot({
"data": [go.Scatter(x = money_x, y = result, name = "Expenditure")],
"layout": go.Layout(title="Expenditure")
}, auto_open=True, show_link=False, output_type = 'div', include_plotlyjs=False)
return render_template('plot.html', name=session['name'], surname=session['surname'], k=str(k), sun=session['student_number'])
Below is an extract from the html file. In the html, I included an online graphic so as to try and see what was wrong with the code - but that has since returned moot.
<div class="container-fluid">
<div class="row text-center">
<div class="col-sm-12">
<br>
<h2 class = "display-2">{{name}} {{surname}}</h2>
</div>
</div>
<div id="cd52e831-399a-403d-9bb2-0c56214b1d38" style="height: 100%; width: 100%;" class="plotly-graph-div"></div>
<script type="text/javascript">window.PLOTLYENV=window.PLOTLYENV || {};window.PLOTLYENV.BASE_URL="https://plot.ly";Plotly.newPlot("cd52e831-399a-403d-9bb2-0c56214b1d38", [{"type": "pie", "values": [4500, 2500, 1053, 500], "labels": ["Oxygen", "Hydrogen", "Carbon_Dioxide", "Nitrogen"]}], {}, {"linkText": "Export to plot.ly", "showLink": true})</script>
<div class="row">
<div class="col-sm-12">
<h4 class = "display-4">Expenditure Plot</h4>
</div>
</div>
{{k}}
</div>
Below is a picture of the observed output of the program. As one can see, the plotly image that was harnessed from online remained unharmed, while my generated graph does not get translated into plotly content.
Please help
(As best as I know, the relevant Javascript has been included for the project)