Permalink
Browse files

fixed x-axis label bug

  • Loading branch information...
1 parent 9eff420 commit 39aff22448bd306c07b595f4f90a3f4e8bc1c31a @jeads jeads committed Feb 13, 2013
@@ -184,7 +184,7 @@ var GraphControlsView = new Class({
this.appContainerSel = '#app_container';
- this.defaultBranchOption = 'v1-train';
+ this.defaultBranchOption = 'master';
//series label ids
this.datasetLegendSel = '#su_legend';
@@ -135,6 +135,7 @@ var PerformanceGraphComponent = new Class({
this.data = data;
this.chartData = {};
+ this.tickDisplayDates = {};
var i = 0;
@@ -143,8 +144,9 @@ var PerformanceGraphComponent = new Class({
var appName = "";
var timestamp = "";
var formattedTime = "";
+ var dataLength = data.length;
- for(i = 0; i<data.length; i++){
+ for(i = 0; i<dataLength; i++){
testId = data[i]['test_id'];
@@ -161,16 +163,15 @@ var PerformanceGraphComponent = new Class({
this.chartData[ testId ][ 'lines' ] = { 'show': true };
this.chartData[ testId ][ 'data' ] = [];
this.chartData[ testId ][ 'full_data' ] = [];
+
}
timestamp = data[i]['date_run'];
//Don't add x-axis labels to the first and last x-axis values
- if((i > 0) && (i < data.length - 1)){
- if(!this.tickDisplayDates[ data[i]['test_run_id'] ]){
- formattedTime = this.view.convertTimestampToDate(timestamp);
- this.tickDisplayDates[ data[i]['test_run_id'] ] = formattedTime;
- }
+ if((i > 0) && (i < dataLength - 1)){
+ formattedTime = this.view.convertTimestampToDate(timestamp);
+ this.tickDisplayDates[ i ] = formattedTime;
}
if(!data[i]['formatted_date_run']){
@@ -181,7 +182,7 @@ var PerformanceGraphComponent = new Class({
//Data for flot
this.chartData[ testId ][ 'data' ].push(
- [ data[i]['test_run_id'], data[i]['avg'] ]
+ [ i, data[i]['avg'] ]
);
//Data for presentation
@@ -217,7 +218,12 @@ var PerformanceGraphComponent = new Class({
);
if(!this.replicatesInitialized && this.seriesIndexDataMap[seriesIndex]){
- this._clickPlot({}, {}, { 'seriesIndex':seriesIndex, 'dataIndex':0 });
+ //Simulate plot click on first series, last datapoint
+ this._clickPlot({}, {}, {
+ 'seriesIndex':0,
+ 'dataIndex':this.seriesIndexDataMap[0]['data'].length - 1
+ });
+
this.view.resetSeriesLabelBackground(this.chartData);
this.replicatesInitialized = true;
}

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -127,15 +127,20 @@ var View = new Class({
convertTimestampToDate: function(unixTimestamp, getHMS){
var dateObj = new Date(unixTimestamp * 1000);
- var dateString = dateObj.getFullYear() + '-' +
- this.padNumber((dateObj.getMonth() + 1), 10, '0') + '-' +
- dateObj.getDate();
+
+ var year = dateObj.getFullYear();
+ var month = this.padNumber(dateObj.getMonth() + 1, 10, '0');
+ var day = this.padNumber(dateObj.getDate(), 10, '0');
+
+ var dateString = year + '-' + month + '-' + day;
if(getHMS){
- dateString += ' ' +
- dateObj.getHours() + ':' +
- dateObj.getMinutes() + ':' +
- this.padNumber(dateObj.getSeconds(), 10, '0');
+
+ var hours = this.padNumber(dateObj.getHours(), 10, '0');
+ var minutes = this.padNumber(dateObj.getMinutes(), 10, '0');
+ var seconds = this.padNumber(dateObj.getSeconds(), 10, '0');
+
+ dateString += ' ' + hours + ':' + minutes + ':' + seconds;
}
return dateString;

0 comments on commit 39aff22

Please sign in to comment.