|
| 1 | +{{define "content"}} |
| 2 | + <main class="container-fluid my-4"> |
| 3 | + <div class="chart-wrapper mb-5"> |
| 4 | + <h2 class="h4">Processed Series (weekly)</h2> |
| 5 | + <p class="text-muted small">Click and drag to zoom into a time range. Right-click to reset.</p> |
| 6 | + <div id="processed_chart_div" style="width: 100%; height: 400px;"></div> |
| 7 | + </div> |
| 8 | + |
| 9 | + <hr class="my-4"> |
| 10 | + |
| 11 | + <div class="chart-wrapper mb-4"> |
| 12 | + <h2 class="h4">Findings (weekly)</h2> |
| 13 | + <p class="text-muted small">Click and drag to zoom into a time range. Right-click to reset.</p> |
| 14 | + <div id="findings_chart_div" style="width: 100%; height: 400px;"></div> |
| 15 | + </div> |
| 16 | + |
| 17 | + <hr class="my-4"> |
| 18 | + |
| 19 | + <div class="chart-wrapper mb-4"> |
| 20 | + <h2 class="h4">Wait Time before Fuzzing (avg hours, weekly)</h2> |
| 21 | + <p class="text-muted small">How many hours have passed since the moment the series was published and the moment we started fuzzing it.</p> |
| 22 | + <p class="text-muted small">Click and drag to zoom into a time range. Right-click to reset.</p> |
| 23 | + <div id="avg_wait_chart_div" style="width: 100%; height: 400px;"></div> |
| 24 | + </div> |
| 25 | + |
| 26 | + <hr class="my-4"> |
| 27 | + |
| 28 | + <div class="chart-wrapper mb-4"> |
| 29 | + <h2 class="h4">Status Distribution (weekly)</h2> |
| 30 | + <p class="text-muted small">Click and drag to zoom into a time range. Right-click to reset.</p> |
| 31 | + <div id="distribution_chart_div" style="width: 100%; height: 400px;"></div> |
| 32 | + </div> |
| 33 | + </main> |
| 34 | + <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> |
| 35 | + <script type="text/javascript"> |
| 36 | + google.charts.load('current', {'packages':['corechart']}); |
| 37 | + google.charts.setOnLoadCallback(drawAllCharts); |
| 38 | + |
| 39 | + const processedData = [ |
| 40 | + {{range .Processed}} |
| 41 | + [new Date({{.Date.Format "2006-01-02"}}), {{.Count}}], |
| 42 | + {{end}} |
| 43 | + ]; |
| 44 | + |
| 45 | + const findingsData = [ |
| 46 | + {{range .Findings}} |
| 47 | + [new Date({{.Date.Format "2006-01-02"}}), {{.Count}}], |
| 48 | + {{end}} |
| 49 | + ]; |
| 50 | + |
| 51 | + const delayData = [ |
| 52 | + {{range .Delay}} |
| 53 | + [new Date({{.Date.Format "2006-01-02"}}), {{.DelayHours}}], |
| 54 | + {{end}} |
| 55 | + ]; |
| 56 | + |
| 57 | + const distributionData = [ |
| 58 | + {{range .Distribution}} |
| 59 | + [new Date({{.Date.Format "2006-01-02"}}), {{.Finished}}, {{.Skipped}}], |
| 60 | + {{end}} |
| 61 | + ]; |
| 62 | + |
| 63 | + function drawAllCharts() { |
| 64 | + drawChart('processed_chart_div', processedData, '#007bff'); |
| 65 | + drawChart('findings_chart_div', findingsData, '#dc3545'); |
| 66 | + drawChart('avg_wait_chart_div', delayData, 'black'); |
| 67 | + drawDistributionChart(); |
| 68 | + } |
| 69 | + |
| 70 | + function drawChart(chartDivId, chartData, chartColor) { |
| 71 | + const data = new google.visualization.DataTable(); |
| 72 | + data.addColumn('date', 'Date'); |
| 73 | + data.addColumn('number', 'Count'); |
| 74 | + data.addRows(chartData); |
| 75 | + const options = { |
| 76 | + legend: { position: 'none' }, |
| 77 | + hAxis: { title: 'Date', format: 'MMM dd, yyyy', gridlines: { color: 'transparent' } }, |
| 78 | + vAxis: { title: 'Count', minValue: 0 }, |
| 79 | + colors: [chartColor], |
| 80 | + curveType: 'function', |
| 81 | + explorer: { |
| 82 | + actions: ['dragToZoom', 'rightClickToReset'], |
| 83 | + axis: 'horizontal', |
| 84 | + keepInBounds: true, |
| 85 | + maxZoomIn: 4.0 |
| 86 | + } |
| 87 | + }; |
| 88 | + |
| 89 | + const chart = new google.visualization.LineChart(document.getElementById(chartDivId)); |
| 90 | + chart.draw(data, options); |
| 91 | + } |
| 92 | + |
| 93 | + function drawDistributionChart() { |
| 94 | + const data = new google.visualization.DataTable(); |
| 95 | + data.addColumn('date', 'Date'); |
| 96 | + data.addColumn('number', 'Processed'); |
| 97 | + data.addColumn('number', 'Skipped'); |
| 98 | + data.addRows(distributionData); |
| 99 | + const options = { |
| 100 | + isStacked: 'percent', |
| 101 | + legend: { position: 'top', maxLines: 2 }, |
| 102 | + hAxis: { title: 'Date', format: 'MMM dd, yyyy', gridlines: { color: 'transparent' } }, |
| 103 | + vAxis: { |
| 104 | + minValue: 0, |
| 105 | + format: '#%' |
| 106 | + }, |
| 107 | + colors: ['#28a745', '#ffc107'], |
| 108 | + areaOpacity: 0.8 |
| 109 | + }; |
| 110 | + const chart = new google.visualization.AreaChart(document.getElementById('distribution_chart_div')); |
| 111 | + chart.draw(data, options); |
| 112 | + } |
| 113 | + </script> |
| 114 | +{{end}} |
0 commit comments