mirror of
				https://github.com/ohwgiles/laminar.git
				synced 2025-06-13 12:54:29 +00:00 
			
		
		
		
	prettier graphs
This commit is contained in:
		
							parent
							
								
									e74332595e
								
							
						
					
					
						commit
						dc3e41fb28
					
				| @ -223,8 +223,11 @@ const Home = function() { | |||||||
|             labels: ["Busy", "Idle"], |             labels: ["Busy", "Idle"], | ||||||
|             datasets: [{ |             datasets: [{ | ||||||
|               data: [ msg.executorsBusy, msg.executorsTotal - msg.executorsBusy ], |               data: [ msg.executorsBusy, msg.executorsTotal - msg.executorsBusy ], | ||||||
|               backgroundColor: ["darkgoldenrod", "forestgreen"] |               backgroundColor: ["#afa674", "#7483af"] | ||||||
|             }] |             }] | ||||||
|  |           }, | ||||||
|  |           options: { | ||||||
|  |             hover: { mode: null } | ||||||
|           } |           } | ||||||
|         }); |         }); | ||||||
|         var buildsPerDayDates = function(){ |         var buildsPerDayDates = function(){ | ||||||
| @ -244,15 +247,13 @@ const Home = function() { | |||||||
|           data: { |           data: { | ||||||
|             labels: buildsPerDayDates.map((e)=>{ return e.short; }), |             labels: buildsPerDayDates.map((e)=>{ return e.short; }), | ||||||
|             datasets: [{ |             datasets: [{ | ||||||
|               label: 'Successful Builds', |  | ||||||
|               backgroundColor: "rgba(34,139,34,0.65)", //forestgreen at 0.65
 |  | ||||||
|               borderColor: "forestgreen", |  | ||||||
|               data: msg.buildsPerDay.map((e)=>{ return e.success || 0; }) |  | ||||||
|             }, { |  | ||||||
|               label: 'Failed Builds', |               label: 'Failed Builds', | ||||||
|               backgroundColor: "rgba(178,34,34,0.65)", //firebrick at 0.65
 |               backgroundColor: "#883d3d", | ||||||
|               borderColor: "firebrick", |  | ||||||
|               data: msg.buildsPerDay.map((e)=>{ return e.failed || 0; }) |               data: msg.buildsPerDay.map((e)=>{ return e.failed || 0; }) | ||||||
|  |             },{ | ||||||
|  |               label: 'Successful Builds', | ||||||
|  |               backgroundColor: "#74af77", | ||||||
|  |               data: msg.buildsPerDay.map((e)=>{ return e.success || 0; }) | ||||||
|             }] |             }] | ||||||
|           }, |           }, | ||||||
|           options:{ |           options:{ | ||||||
| @ -260,10 +261,13 @@ const Home = function() { | |||||||
|             tooltips:{callbacks:{title: function(tip, data) { |             tooltips:{callbacks:{title: function(tip, data) { | ||||||
|               return buildsPerDayDates[tip[0].index].long; |               return buildsPerDayDates[tip[0].index].long; | ||||||
|             }}}, |             }}}, | ||||||
|             scales:{yAxes:[{ticks:{userCallback: (label, index, labels)=>{ |             scales:{yAxes:[{ | ||||||
|               if(Number.isInteger(label)) |               ticks:{userCallback: (label, index, labels)=>{ | ||||||
|                 return label; |                 if(Number.isInteger(label)) | ||||||
|             }}}]} |                   return label; | ||||||
|  |               }}, | ||||||
|  |               stacked: true | ||||||
|  |             }]} | ||||||
|           } |           } | ||||||
|         }); |         }); | ||||||
|         chtBuildsPerJob = new Chart(document.getElementById("chartBpj"), { |         chtBuildsPerJob = new Chart(document.getElementById("chartBpj"), { | ||||||
| @ -272,12 +276,13 @@ const Home = function() { | |||||||
|             labels: Object.keys(msg.buildsPerJob), |             labels: Object.keys(msg.buildsPerJob), | ||||||
|             datasets: [{ |             datasets: [{ | ||||||
|               label: 'Runs in last 24 hours', |               label: 'Runs in last 24 hours', | ||||||
|               backgroundColor: "steelblue", |               backgroundColor: "#7483af", | ||||||
|               data: Object.keys(msg.buildsPerJob).map((e)=>{ return msg.buildsPerJob[e]; }) |               data: Object.keys(msg.buildsPerJob).map((e)=>{ return msg.buildsPerJob[e]; }) | ||||||
|             }] |             }] | ||||||
|           }, |           }, | ||||||
|           options:{ |           options:{ | ||||||
|             title: { display: true, text: 'Builds per job' }, |             title: { display: true, text: 'Builds per job' }, | ||||||
|  |             hover: { mode: null }, | ||||||
|             scales:{xAxes:[{ticks:{userCallback: (label, index, labels)=>{ |             scales:{xAxes:[{ticks:{userCallback: (label, index, labels)=>{ | ||||||
|               if(Number.isInteger(label)) |               if(Number.isInteger(label)) | ||||||
|                 return label; |                 return label; | ||||||
| @ -291,12 +296,13 @@ const Home = function() { | |||||||
|             labels: Object.keys(msg.timePerJob), |             labels: Object.keys(msg.timePerJob), | ||||||
|             datasets: [{ |             datasets: [{ | ||||||
|               label: 'Mean run time this week', |               label: 'Mean run time this week', | ||||||
|               backgroundColor: "steelblue", |               backgroundColor: "#7483af", | ||||||
|               data: Object.keys(msg.timePerJob).map((e)=>{ return msg.timePerJob[e]; }) |               data: Object.keys(msg.timePerJob).map((e)=>{ return msg.timePerJob[e]; }) | ||||||
|             }] |             }] | ||||||
|           }, |           }, | ||||||
|           options:{ |           options:{ | ||||||
|             title: { display: true, text: 'Mean run time this week' }, |             title: { display: true, text: 'Mean run time this week' }, | ||||||
|  |             hover: { mode: null }, | ||||||
|             scales:{xAxes:[{ |             scales:{xAxes:[{ | ||||||
|               ticks:{userCallback: tpjScale.scale}, |               ticks:{userCallback: tpjScale.scale}, | ||||||
|               scaleLabel: { |               scaleLabel: { | ||||||
| @ -317,13 +323,13 @@ const Home = function() { | |||||||
|             datasets: msg.buildTimeChanges.map((e)=>{return { |             datasets: msg.buildTimeChanges.map((e)=>{return { | ||||||
|               label: e.name, |               label: e.name, | ||||||
|               data: e.durations, |               data: e.durations, | ||||||
|               borderColor: 'hsl('+(e.name.hashCode() % 360)+', 61%, 34%)', |               borderColor: 'hsl('+(e.name.hashCode() % 360)+', 27%, 57%)', | ||||||
|               backgroundColor: 'transparent' |               backgroundColor: 'transparent' | ||||||
|             }}) |             }}) | ||||||
|           }, |           }, | ||||||
|           options:{ |           options:{ | ||||||
|             title: { display: true, text: 'Build time changes' }, |             title: { display: true, text: 'Build time changes' }, | ||||||
|             legend:{display:true}, |             legend:{ display: true, position: 'bottom' }, | ||||||
|             scales:{ |             scales:{ | ||||||
|               xAxes:[{ticks:{display: false}}], |               xAxes:[{ticks:{display: false}}], | ||||||
|               yAxes:[{ |               yAxes:[{ | ||||||
| @ -346,7 +352,7 @@ const Home = function() { | |||||||
|             datasets: [{ |             datasets: [{ | ||||||
|               label: 'Number jobs with average build time in range', |               label: 'Number jobs with average build time in range', | ||||||
|               data: msg.buildTimeDist, |               data: msg.buildTimeDist, | ||||||
|               backgroundColor: "steelblue", |               backgroundColor: "#7483af", | ||||||
|             }] |             }] | ||||||
|           }, |           }, | ||||||
|           options: { |           options: { | ||||||
| @ -531,7 +537,7 @@ var Job = function() { | |||||||
|               label: 'Average', |               label: 'Average', | ||||||
|               type: 'line', |               type: 'line', | ||||||
|               data: [{x:0,y:msg.averageRuntime},{x:1,y:msg.averageRuntime}], |               data: [{x:0,y:msg.averageRuntime},{x:1,y:msg.averageRuntime}], | ||||||
|               borderColor: 'steelblue', |               borderColor: '#7483af', | ||||||
|               backgroundColor: 'transparent', |               backgroundColor: 'transparent', | ||||||
|               xAxisID: 'avg', |               xAxisID: 'avg', | ||||||
|               pointRadius: 0, |               pointRadius: 0, | ||||||
| @ -547,8 +553,12 @@ var Job = function() { | |||||||
|           }, |           }, | ||||||
|           options: { |           options: { | ||||||
|             title: { display: true, text: 'Build time' }, |             title: { display: true, text: 'Build time' }, | ||||||
|  |             hover: { mode: null }, | ||||||
|             scales:{ |             scales:{ | ||||||
|               xAxes:[{},{ |               xAxes:[{ | ||||||
|  |                 categoryPercentage: 1.0, | ||||||
|  |                 barPercentage: 1.0 | ||||||
|  |               },{ | ||||||
|                 id: 'avg', |                 id: 'avg', | ||||||
|                 type: 'linear', |                 type: 'linear', | ||||||
|                 ticks: { |                 ticks: { | ||||||
| @ -699,6 +709,8 @@ Chart.scaleService.updateScaleDefaults('linear', { | |||||||
| }); | }); | ||||||
| // Don't display legend by default
 | // Don't display legend by default
 | ||||||
| Chart.defaults.global.legend.display = false; | Chart.defaults.global.legend.display = false; | ||||||
|  | // Disable tooltip hover animations
 | ||||||
|  | Chart.defaults.global.hover.animationDuration = 0; | ||||||
| // Plugin to move a DOM item on top of a chart element
 | // Plugin to move a DOM item on top of a chart element
 | ||||||
| Chart.plugins.register({ | Chart.plugins.register({ | ||||||
|   afterDatasetsDraw: (chart) => { |   afterDatasetsDraw: (chart) => { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user