Commit d745876e authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Code corrections with a helper and a variable

parent b4795830
...@@ -50,19 +50,19 @@ class PrometheusGraph { ...@@ -50,19 +50,19 @@ class PrometheusGraph {
} }
plotValues(key) { plotValues(key) {
const graphSpecifics = this.graphSpecificProperties[key];
const x = d3.time.scale() const x = d3.time.scale()
.range([0, this.width]); .range([0, this.width]);
const y = d3.scale.linear() const y = d3.scale.linear()
.range([this.height, 0]); .range([this.height, 0]);
this.graphSpecificProperties[key].xScale = x; graphSpecifics.xScale = x;
this.graphSpecificProperties[key].yScale = y; graphSpecifics.yScale = y;
const prometheusGraphContainer = `${prometheusGraphsContainer}[graph-type=${key}]`; const prometheusGraphContainer = `${prometheusGraphsContainer}[graph-type=${key}]`;
const graphSpecifics = this.graphSpecificProperties[key];
const chart = d3.select(prometheusGraphContainer) const chart = d3.select(prometheusGraphContainer)
.attr('width', this.width + this.margin.left + this.margin.right) .attr('width', this.width + this.margin.left + this.margin.right)
.attr('height', this.height + this.margin.bottom + this.margin.top) .attr('height', this.height + this.margin.bottom + this.margin.top)
...@@ -142,9 +142,9 @@ class PrometheusGraph { ...@@ -142,9 +142,9 @@ class PrometheusGraph {
.attr('stroke-width', '1') .attr('stroke-width', '1')
.attr({ .attr({
x1: 10, x1: 10,
y1: this.originalHeight - 80, y1: this.originalHeight - this.margin.top,
x2: (this.originalWidth - this.margin.right) + 10, x2: (this.originalWidth - this.margin.right) + 10,
y2: this.originalHeight - 80, y2: this.originalHeight - this.margin.top,
}); });
axisLabelContainer.append('line') axisLabelContainer.append('line')
...@@ -155,7 +155,7 @@ class PrometheusGraph { ...@@ -155,7 +155,7 @@ class PrometheusGraph {
x1: 10, x1: 10,
y1: 0, y1: 0,
x2: 10, x2: 10,
y2: this.originalHeight - 80, y2: this.originalHeight - this.margin.top,
}); });
axisLabelContainer.append('rect') axisLabelContainer.append('rect')
.attr('class', 'rect-axis-text') .attr('class', 'rect-axis-text')
...@@ -167,7 +167,7 @@ class PrometheusGraph { ...@@ -167,7 +167,7 @@ class PrometheusGraph {
axisLabelContainer.append('text') axisLabelContainer.append('text')
.attr('class', 'label-axis-text') .attr('class', 'label-axis-text')
.attr('text-anchor', 'middle') .attr('text-anchor', 'middle')
.attr('transform', `translate(15, ${(this.originalHeight - 80) / 2}) rotate(-90)`) .attr('transform', `translate(15, ${(this.originalHeight - this.margin.top) / 2}) rotate(-90)`)
.text(graphSpecifics.graph_legend_title); .text(graphSpecifics.graph_legend_title);
axisLabelContainer.append('rect') axisLabelContainer.append('rect')
...@@ -180,7 +180,7 @@ class PrometheusGraph { ...@@ -180,7 +180,7 @@ class PrometheusGraph {
axisLabelContainer.append('text') axisLabelContainer.append('text')
.attr('class', 'label-axis-text') .attr('class', 'label-axis-text')
.attr('x', (this.originalWidth / 2) - this.margin.right) .attr('x', (this.originalWidth / 2) - this.margin.right)
.attr('y', this.originalHeight - 80) .attr('y', this.originalHeight - this.margin.top)
.attr('dy', '.35em') .attr('dy', '.35em')
.text('Time'); .text('Time');
......
...@@ -11,8 +11,7 @@ ...@@ -11,8 +11,7 @@
.col-sm-6 .col-sm-6
%h3.page-title %h3.page-title
Environment: Environment:
= link_to environment_path(@environment) do = link_to @environment.name, environment_path(@environment)
= @environment.name
.col-sm-6 .col-sm-6
.nav-controls .nav-controls
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment