mirror of
https://gitlab.silvrtree.co.uk/martind2000/mdot_server.git
synced 2025-01-26 20:16:17 +00:00
new graph
This commit is contained in:
parent
41cb0a4e8b
commit
6efd3a7a9e
@ -274,9 +274,11 @@ var self = this;
|
||||
var chartData = [];
|
||||
|
||||
var temporal = {high:0, low:0};
|
||||
var HL = {high:0,low:0}
|
||||
|
||||
_(this.collection.models).each(function(i) {
|
||||
var dt = i.get('dt');
|
||||
var value = i.get(getMode);
|
||||
if (temporal.low === 0 || dt < temporal.low) {
|
||||
temporal.low = dt;
|
||||
}
|
||||
@ -284,13 +286,23 @@ var self = this;
|
||||
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({
|
||||
date: dt,
|
||||
value: i.get(getMode)
|
||||
value: value
|
||||
});
|
||||
|
||||
}, this);
|
||||
|
||||
|
||||
console.log('this.temporal', this.temporal);
|
||||
console.log('temporal', temporal);
|
||||
console.log(chartData);
|
||||
|
||||
|
||||
@ -347,33 +359,14 @@ var self = this;
|
||||
|
||||
// HORIZONTAL GREEN RANGE
|
||||
var guide = new AmCharts.Guide();
|
||||
guide.value = 10;
|
||||
guide.toValue = 20;
|
||||
guide.value = 525;
|
||||
guide.toValue = 575;
|
||||
guide.fillColor = "#00CC00";
|
||||
guide.inside = true;
|
||||
guide.fillAlpha = 0.2;
|
||||
guide.lineAlpha = 0;
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user