
  Highcharts.setOptions({
      global : {
          useUTC : false
      }
  });

	$('#test_history_chart').highcharts({
        chart: {
            type: 'column'
        },
        title: {
            text: 'Recent test results and time'
        },
       xAxis: {
          categories: <%= raw @recent_build_times.collect{|x| x[:time].localtime.strftime('%Y-%m-%d %H:%M')}.inspect rescue [] %>
       },
        yAxis: {
            min: 0,
            title: {
                text: 'Time (s)'
            }
        },
        tooltip: {
						formatter: function() {
              var tooltip_display = "";              
              tooltip_display = this.x  + '<br/>' +
									'<b>' + (this.color == '#d9534f' ? 'Failed' : 'Pass') +'</b>' +  ', '  + this.y + ' secs';
              if (this.point.agent) {
                tooltip_display += "<br/><i>(" + this.point.agent + ")</i>";
              }
              return tooltip_display;
            }
        },
        plotOptions: {
	        column: {
						colorByPoint: true
	        }
        },
        series: [
          {
			      showInLegend: false,
            enableMouseTracking: true,							 						
            data: <%= raw @recent_build_times.collect{|x| {y: x[:duration], color: x[:color], agent: x[:agent], ok: x[:successful] }}.to_json rescue []  %>
        	}
		    ]
    });


$("#test_history_header").html("<%= @test_file_name %>");
$("#test_history_dialog").modal("show");
