tweak karma graph output for many data points
if there's a ton of data points, the graph starts looking real gross, so do a couple things to make the display of that a bit simpler so there's less noise and distracting lines and whatnot
This commit is contained in:
		
							parent
							
								
									3e9302c89c
								
							
						
					
					
						commit
						08da8ea9f3
					
				| @ -13,6 +13,17 @@ | |||||||
|   <script type="text/javascript"> |   <script type="text/javascript"> | ||||||
|     Chart.defaults.global.responsive = true; |     Chart.defaults.global.responsive = true; | ||||||
|     Chart.defaults.global.maintainAspectRatio = true; |     Chart.defaults.global.maintainAspectRatio = true; | ||||||
|  |     Chart.types.Line.extend({name : "AltLine", | ||||||
|  |       initialize : function(data) { | ||||||
|  |         Chart.types.Line.prototype.initialize.apply(this, arguments); | ||||||
|  |         this.scale.draw = function() { | ||||||
|  |            if (this.display && (this.xLabelRotation > 90)) { | ||||||
|  |               this.endPoint = this.height - 5; | ||||||
|  |            } | ||||||
|  |            Chart.Scale.prototype.draw.apply(this, arguments); | ||||||
|  |         }; | ||||||
|  |       } | ||||||
|  |     }); | ||||||
|     var ctx = $("#karma_history").get(0).getContext("2d"); |     var ctx = $("#karma_history").get(0).getContext("2d"); | ||||||
|     var data = { |     var data = { | ||||||
|       labels: ["EPOCH", {% for x in entry.history %}"{{ x.0 }}", {% endfor %}], |       labels: ["EPOCH", {% for x in entry.history %}"{{ x.0 }}", {% endfor %}], | ||||||
| @ -29,8 +40,13 @@ | |||||||
|         } |         } | ||||||
|       ] |       ] | ||||||
|     }; |     }; | ||||||
|     var myLineChart = new Chart(ctx).Line(data, { |     var myLineChart = new Chart(ctx).AltLine(data, { | ||||||
|       pointDot: false |       pointDot: false, | ||||||
|  |       {% if entry.history|length > 100 %} | ||||||
|  |         showTooltips: false, | ||||||
|  |         scaleShowVerticalLines: false, | ||||||
|  |       {% endif %} | ||||||
|  |       tooltipEvents: ["click"] | ||||||
|     }); |     }); | ||||||
|   </script> |   </script> | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user