Guest User

Untitled

a guest
Apr 16th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. <script>
  2. var pieData = [
  3. {% for item,label,colors in set %}
  4. {
  5. value: {{item}},
  6. label: "{{label}}",
  7. color : "{{colors}}"
  8. },
  9. {% endfor %}
  10.  
  11.  
  12. ];
  13.  
  14. // get bar chart canvas
  15. var mychart = document.getElementById("chart").getContext("2d");
  16.  
  17. steps = 10
  18. max = 10
  19. // draw pie chart
  20. new Chart(document.getElementById("chart").getContext("2d")).Pie(pieData);
  21.  
  22. </script>
  23.  
  24. @app.route('/user/<username>')
  25. @login_required
  26. def user(username):
  27.  
  28.  
  29. user = User.query.filter_by(username=username).first_or_404()
  30.  
  31.  
  32. labels = ["January","February","March","April","May","June","July","August"]
  33. values = [10,9,8,7,6,4,7,8]
  34. colors = [ "#F7464A", "#46BFBD", "#FDB45C", "#FEDCBA","#ABCDEF", "#DDDDDD", "#ABCABC" ]
  35.  
  36.  
  37. return render_template('user.html', user=user,attendance=attendance, set=zip(values, labels, colors))
Add Comment
Please, Sign In to add comment