Skip to content

Commit

Permalink
Merge pull request #403 from yaacov/fix-multiple-graphs
Browse files Browse the repository at this point in the history
Fix view multiple graphs
  • Loading branch information
himdel authored Feb 16, 2017
2 parents f807ffe + aeb4138 commit ce3b814
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@
dash.refresh_graph = function(metricId, metricType, currentItem) {
var numberOfBucketsInChart = 300;

dash.metricId = metricId;
dash.currentItem = currentItem;
var ends = dash.timeFilter.date.valueOf(); // javascript time is in milisec
var diff = dash.timeFilter.time_range * dash.timeFilter.range_count * NUMBER_OF_MILLISEC_IN_HOUR; // time_range is in hours
var starts = ends - diff;
Expand All @@ -118,11 +116,11 @@
}

// hawkular time is in milisec (hawkular bucket_duration is in seconds)
var params = '&query=get_data&type=' + metricType + '&metric_id=' + dash.metricId + '&ends=' + ends +
var params = '&query=get_data&type=' + metricType + '&metric_id=' + metricId + '&ends=' + ends +
'&starts=' + starts + '&bucket_duration=' + bucket_duration + 's';

$http.get(dash.url + params)
.then(getContainerParamsData)
.then(function(response) { getContainerParamsData(metricId, currentItem, response); })
.catch(miqService.handleFailure);
};

Expand Down Expand Up @@ -299,7 +297,7 @@
dash.filterConfig.resultsCount = dash.items.length;
}

function getContainerParamsData(response) {
function getContainerParamsData(metricId, currentItem, response) {
'use strict';

if (response.data.error) {
Expand All @@ -312,11 +310,10 @@
var yData = data.map(function(d) { return d.avg || null; });

xData.unshift('time');
yData.unshift(dash.metricId);
yData.unshift(metricId);

// TODO: Use time buckets
dash.chartData.xData = xData;
dash.chartData['yData'+ dash.currentItem] = yData;
dash.chartData['yData'+ currentItem] = yData;

dash.chartDataInit = true;
dash.loadCount++;
Expand Down

0 comments on commit ce3b814

Please sign in to comment.