Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

added a max parameter to control the graph y axis per graph #79

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 31 additions & 13 deletions lib/tasseo/public/j/tasseo.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ function TasseoMetric(element, metricSpec, dashboardOptions) {

this.element = element
this.alias = this.alias || this.target;
this.max = this.max || null;
this.transform = this.transform || function(value) { return value; };
this.metricSpec = metricSpec
this.dashboardOptions = dashboardOptions;
Expand All @@ -84,19 +85,36 @@ function TasseoMetric(element, metricSpec, dashboardOptions) {
TasseoMetric.prototype = {
clear: function() {
this.datum = [{ x:0, y:0 }];
this.graph = new Rickshaw.Graph({
element: this.element,
width: this.dashboardOptions.graph_width || 348,
height: this.dashboardOptions.graph_height || 100,
interpolation: this.dashboardOptions.interpolation,
renderer: this.dashboardOptions.renderer,
stroke: this.dashboardOptions.stroke,
series: [{
name: this.alias,
color: this.dashboardOptions.normalColor,
data: this.datum
}]
});
if (this.max) {
this.graph = new Rickshaw.Graph({
element: this.element,
width: this.dashboardOptions.graph_width || 348,
height: this.dashboardOptions.graph_height || 100,
interpolation: this.dashboardOptions.interpolation,
renderer: this.dashboardOptions.renderer,
stroke: this.dashboardOptions.stroke,
max: this.max,
series: [{
name: this.alias,
color: this.dashboardOptions.normalColor,
data: this.datum
}]
});
} else {
this.graph = new Rickshaw.Graph({
element: this.element,
width: this.dashboardOptions.graph_width || 348,
height: this.dashboardOptions.graph_height || 100,
interpolation: this.dashboardOptions.interpolation,
renderer: this.dashboardOptions.renderer,
stroke: this.dashboardOptions.stroke,
series: [{
name: this.alias,
color: this.dashboardOptions.normalColor,
data: this.datum
}]
});
}

this.graph.render();
},
Expand Down