Allowing static axes in charts
Setting static time span according to what what picked by user. Depends on Horizon patch: https://review.openstack.org/#/c/110635/ Change-Id: I7ad94b3bb153eecec6375c04baa7ad41cf9f3350
This commit is contained in:
parent
659ea6a1eb
commit
e69092a9f9
@ -176,13 +176,16 @@ class PerformanceView(base.TemplateView):
|
||||
else:
|
||||
meters = get_meters([meter])
|
||||
|
||||
date_from, date_to = _calc_date_args(date_from,
|
||||
date_to,
|
||||
date_options)
|
||||
|
||||
series = []
|
||||
for meter_id, meter_name in meters:
|
||||
resources, unit = query_data(
|
||||
request=request,
|
||||
date_from=date_from,
|
||||
date_to=date_to,
|
||||
date_options=date_options,
|
||||
group_by=group_by,
|
||||
meter=meter_id,
|
||||
query=query)
|
||||
@ -218,8 +221,9 @@ class PerformanceView(base.TemplateView):
|
||||
if barchart:
|
||||
average, used, tooltip_average = get_barchart_stats(series,
|
||||
unit)
|
||||
|
||||
json_output = create_json_output(series)
|
||||
start_datetime = date_from.strftime("%Y-%m-%dT%H:%M:%S")
|
||||
end_datetime = date_to.strftime("%Y-%m-%dT%H:%M:%S")
|
||||
json_output = create_json_output(series, start_datetime, end_datetime)
|
||||
|
||||
if barchart:
|
||||
json_output = add_barchart_settings(json_output, average, used,
|
||||
@ -233,15 +237,12 @@ class PerformanceView(base.TemplateView):
|
||||
def query_data(request,
|
||||
date_from,
|
||||
date_to,
|
||||
date_options,
|
||||
group_by,
|
||||
meter,
|
||||
period=None,
|
||||
query=None,
|
||||
additional_query=None):
|
||||
date_from, date_to = _calc_date_args(date_from,
|
||||
date_to,
|
||||
date_options)
|
||||
|
||||
if not period:
|
||||
period = _calc_period(date_from, date_to, 20)
|
||||
if additional_query is None:
|
||||
@ -366,17 +367,19 @@ def get_barchart_stats(series, unit):
|
||||
return average, used, tooltip_average
|
||||
|
||||
|
||||
def create_json_output(series):
|
||||
def create_json_output(series, start_datetime, end_datetime):
|
||||
return {
|
||||
'series': series,
|
||||
'settings': {
|
||||
'renderer': 'StaticAxes',
|
||||
'yMin': 0,
|
||||
'xMin': start_datetime,
|
||||
'xMax': end_datetime,
|
||||
'higlight_last_point': True,
|
||||
'auto_size': False,
|
||||
'auto_resize': False,
|
||||
'axes_x': False,
|
||||
'axes_y': True,
|
||||
'axes_y': False,
|
||||
},
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user