dashboard.html 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. {% extends "base/base.html" %}
  2. {% block content %}
  3. <div>
  4. <canvas id="myChart"></canvas>
  5. </div>
  6. <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
  7. <script>
  8. var CHART_COLORS = {
  9. red: 'rgb(255, 99, 132)',
  10. orange: 'rgb(255, 159, 64)',
  11. yellow: 'rgb(255, 205, 86)',
  12. green: 'rgb(75, 192, 192)',
  13. blue: 'rgb(54, 162, 235)',
  14. purple: 'rgb(153, 102, 255)',
  15. grey: 'rgb(201, 203, 207)'
  16. };
  17. var ctx = document.getElementById('myChart');
  18. new Chart(ctx, {
  19. type: 'bar',
  20. data: {
  21. labels: [' < 2 Wochen',
  22. ' 2 - 4 Wochen',
  23. ' 4 - 6 Wochen',
  24. ' 6 - 12 Wochen',
  25. ' noch nicht fällig',
  26. '> 12 Wochen'],
  27. datasets: [{
  28. label: 'Verkauf',
  29. data: [12, 19, 3, 5, 2, 3],
  30. borderWidth: 1,
  31. backgroundColor: CHART_COLORS.red
  32. },
  33. {
  34. label: 'Service',
  35. data: [12, 19, 3, 5, 2, 3],
  36. borderWidth: 1,
  37. backgroundColor: CHART_COLORS.blue
  38. },
  39. {
  40. label: 'TZ',
  41. data: [12, 19, 3, 5, 2, 3],
  42. borderWidth: 1,
  43. backgroundColor: CHART_COLORS.green
  44. },{
  45. label: 'Sonstige',
  46. data: [12, 19, 3, 5, 2, 3],
  47. borderWidth: 1,
  48. backgroundColor: CHART_COLORS.yellow
  49. }]
  50. },
  51. options: {
  52. plugins: {
  53. title: {
  54. display: true,
  55. text: 'Chart.js Bar Chart - Stacked'
  56. },
  57. },
  58. responsive: true,
  59. scales: {
  60. x: {
  61. stacked: true,
  62. },
  63. y: {
  64. stacked: true
  65. }
  66. }
  67. }
  68. });
  69. </script>
  70. {% endblock %}