forked from 3wordchant/capsul-flask
		
	fix minor wonks with metrics
This commit is contained in:
		| @ -1,6 +1,7 @@ | ||||
| import matplotlib.ticker as ticker | ||||
| import matplotlib.pyplot as pyplot | ||||
| import matplotlib.dates as mdates | ||||
| from functools import reduce  | ||||
| import requests | ||||
| #import json | ||||
| from datetime import datetime | ||||
| @ -175,7 +176,7 @@ def draw_plot_bytes(data, scale, size_x=3, size_y=1): | ||||
|     my_plot.xaxis.set_major_locator(day_locator) | ||||
|     my_plot.xaxis.set_major_formatter(day_formatter) | ||||
|  | ||||
|  | ||||
|   max_value = reduce(lambda a, b: a if a > b else b, y, scale) | ||||
|   average=(sum(y)/len(y))/scale | ||||
|   average=average*1.25+0.1 | ||||
|  | ||||
| @ -186,7 +187,7 @@ def draw_plot_bytes(data, scale, size_x=3, size_y=1): | ||||
|   fill_color=color_gradient(average) | ||||
|   highlight_color=lerp_rgb_tuples(fill_color, (1,1,1), 0.5) | ||||
|  | ||||
|   my_plot.fill_between( x, scale, color=bg_color, alpha=0.13) | ||||
|   my_plot.fill_between( x, max_value, color=bg_color, alpha=0.13) | ||||
|   my_plot.fill_between( x, y, color=highlight_color, alpha=0.3) | ||||
|   my_plot.plot(x, y, 'r-', color=highlight_color) | ||||
|  | ||||
|  | ||||
| @ -20,10 +20,7 @@ | ||||
|   {% endfor %} | ||||
| </div> | ||||
| <div class="row"> | ||||
|   <div> | ||||
|     <h1>cpu</h1> | ||||
|     <img src="/metrics/{{ metric }}/{{ vm['id'] }}/{{ duration }}/l"/> | ||||
|   </div> | ||||
|   <img src="/metrics/{{ metric }}/{{ vm['id'] }}/{{ duration }}/l"/> | ||||
| </div> | ||||
|  | ||||
| {% endblock %} | ||||
|  | ||||
		Reference in New Issue
	
	Block a user