Skip to content
Browse files

part way moving to addPlotLine

  • Loading branch information...
1 parent 1921b2f commit 19982a0e9a97a8c39be087ec48a7ed7027cfded0 @jessereynolds jessereynolds committed Apr 3, 2012
Showing with 35 additions and 15 deletions.
  1. +35 −15 lib/visage-app/public/javascripts/graph.js
View
50 lib/visage-app/public/javascripts/graph.js
@@ -183,6 +183,7 @@ var VisageBase = new Class({
return url.join('/')
},
getData: function() {
+ console.dir("in getData...");
this.request = new Request.JSONP({
url: this.dataURL(),
data: this.requestData,
@@ -225,6 +226,8 @@ var VisageGraph = new Class({
Implements: Chain,
// assemble data to graph, then draw it
graphData: function(data) {
+ console.dir("in graphData... got data:");
+ console.dir(data);
this.response = data
this.buildDataStructures()
this.lastStart = this.series[0].data[0][0]
@@ -250,13 +253,19 @@ var VisageGraph = new Class({
});
this.chart.redraw();
+ this.drawPercentiles()
break;
default:
this.drawChart()
+ this.drawPercentiles()
break;
}
},
buildDataStructures: function (data) {
+ console.dir("in buildDataStructures... data:");
+ console.dir(data);
+ console.dir("this:");
+ console.dir(this);
var series = this.series = []
var host = this.options.host
var plugin = this.options.plugin
@@ -284,10 +293,13 @@ var VisageGraph = new Class({
series.push(set)
}, this);
}, this);
+ console.dir("buildDataStructures is returning series:");
console.dir(series)
return series
},
getSeriesMinMax: function(series) {
+ console.dir("in getSeriesMinMax... series:");
+ console.dir(series);
var min, max;
series.each(function(set) {
@@ -314,7 +326,26 @@ var VisageGraph = new Class({
return {'min': min, 'max': max};
},
+ drawPercentiles: function() {
+ var plotLines = [],
+ series = this.series;
+
+ series.each(function(set) {
+ this.chart.addPlotLine({
+ id: '95e_' + set.name[3],
+ value: set.percentile95,
+ color: '#ff0000',
+ width: 1,
+ zIndex: 5,
+ label: {
+ text: '95e ' + set.name[3] + ": " + set.percentile95,
+ }
+ })
+ });
+ },
drawChart: function() {
+ console.dir("in drawChart...");
+
var series = this.series,
title = this.title(),
element = this.parentElement,
@@ -328,20 +359,6 @@ var VisageGraph = new Class({
var min = meta.min,
max = meta.max;
- myPlotLines = [];
- series.each(function(set) {
- myPlotLines.push({
- id: '95e_' + set.name[3],
- value: set.percentile95,
- color: '#ff0000',
- width: 1,
- zIndex: 5,
- label: {
- text: '95e ' + set.name[3] + ": " + set.percentile95,
- }
- })
- });
- console.dir(myPlotLines);
this.chart = new Highcharts.Chart({
series: series,
chart: {
@@ -419,7 +436,7 @@ var VisageGraph = new Class({
return value
}
},
- plotLines: myPlotLines
+ //plotLines: plotLines
},
plotOptions: {
series: {
@@ -489,6 +506,7 @@ var VisageGraph = new Class({
this.buildDateSelector();
},
buildDateSelector: function() {
+ console.dir("in buildDateSelector...");
/*
* container
* \
@@ -620,6 +638,8 @@ var VisageGraph = new Class({
container.grab(form, 'top')
},
setTimePeriodTo: function(selected) {
+ console.dir("in setTimePeriodTo... selected:");
+ console.dir(selected);
var option = this.select.getElements('option').filter(function(opt) {
return opt.text == selected.text
})[0];

0 comments on commit 19982a0

Please sign in to comment.
Something went wrong with that request. Please try again.