mirror of
https://gitlab.silvrtree.co.uk/martind2000/mdot_server.git
synced 2025-02-10 20:09:17 +00:00
new graph
This commit is contained in:
parent
41cb0a4e8b
commit
6efd3a7a9e
@ -274,9 +274,11 @@ var self = this;
|
|||||||
var chartData = [];
|
var chartData = [];
|
||||||
|
|
||||||
var temporal = {high:0, low:0};
|
var temporal = {high:0, low:0};
|
||||||
|
var HL = {high:0,low:0}
|
||||||
|
|
||||||
_(this.collection.models).each(function(i) {
|
_(this.collection.models).each(function(i) {
|
||||||
var dt = i.get('dt');
|
var dt = i.get('dt');
|
||||||
|
var value = i.get(getMode);
|
||||||
if (temporal.low === 0 || dt < temporal.low) {
|
if (temporal.low === 0 || dt < temporal.low) {
|
||||||
temporal.low = dt;
|
temporal.low = dt;
|
||||||
}
|
}
|
||||||
@ -284,13 +286,23 @@ var self = this;
|
|||||||
temporal.high = dt;
|
temporal.high = dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (HL.low === 0 || value < HL.low) {
|
||||||
|
HL.low = value;
|
||||||
|
}
|
||||||
|
if (HL.high === 0 || value > HL.high) {
|
||||||
|
HL.high = value;
|
||||||
|
}
|
||||||
|
|
||||||
chartData.push({
|
chartData.push({
|
||||||
date: dt,
|
date: dt,
|
||||||
value: i.get(getMode)
|
value: value
|
||||||
});
|
});
|
||||||
|
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
|
||||||
|
console.log('this.temporal', this.temporal);
|
||||||
|
console.log('temporal', temporal);
|
||||||
console.log(chartData);
|
console.log(chartData);
|
||||||
|
|
||||||
|
|
||||||
@ -347,33 +359,14 @@ var self = this;
|
|||||||
|
|
||||||
// HORIZONTAL GREEN RANGE
|
// HORIZONTAL GREEN RANGE
|
||||||
var guide = new AmCharts.Guide();
|
var guide = new AmCharts.Guide();
|
||||||
guide.value = 10;
|
guide.value = 525;
|
||||||
guide.toValue = 20;
|
guide.toValue = 575;
|
||||||
guide.fillColor = "#00CC00";
|
guide.fillColor = "#00CC00";
|
||||||
guide.inside = true;
|
guide.inside = true;
|
||||||
guide.fillAlpha = 0.2;
|
guide.fillAlpha = 0.2;
|
||||||
guide.lineAlpha = 0;
|
guide.lineAlpha = 0;
|
||||||
valueAxis.addGuide(guide);
|
valueAxis.addGuide(guide);
|
||||||
|
|
||||||
// TREND LINES
|
|
||||||
// first trend line
|
|
||||||
var trendLine = new AmCharts.TrendLine();
|
|
||||||
// note,when creating date objects 0 month is January, as months are zero based in JavaScript.
|
|
||||||
trendLine.initialDate = temporal.low; // 12 is hour - to start trend line in the middle of the day
|
|
||||||
trendLine.finalDate = temporal.high;
|
|
||||||
trendLine.initialValue = 10;
|
|
||||||
trendLine.finalValue = 19;
|
|
||||||
trendLine.lineColor = "#CC0000";
|
|
||||||
self.chart.addTrendLine(trendLine);
|
|
||||||
|
|
||||||
// second trend line
|
|
||||||
trendLine = new AmCharts.TrendLine();
|
|
||||||
trendLine.initialDate = temporal.low; // 12 is hour - to start trend line in the middle of the day
|
|
||||||
trendLine.finalDate = temporal.high;
|
|
||||||
trendLine.initialValue = 16;
|
|
||||||
trendLine.finalValue = 10;
|
|
||||||
trendLine.lineColor = "#CC0000";
|
|
||||||
self.chart.addTrendLine(trendLine);
|
|
||||||
|
|
||||||
// WRITE
|
// WRITE
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user