|
|
@ -257,22 +257,20 @@ Graph2d.prototype.isGroupVisible = function(groupId) { |
|
|
|
* When no maximum is found, max==null |
|
|
|
*/ |
|
|
|
Graph2d.prototype.getItemRange = function() { |
|
|
|
var min = null; |
|
|
|
var max = null; |
|
|
|
|
|
|
|
// calculate min from start filed
|
|
|
|
var dataset = this.itemsData.getDataSet(), |
|
|
|
min = null, |
|
|
|
max = null; |
|
|
|
|
|
|
|
if (dataset) { |
|
|
|
// calculate the minimum value of the field 'start'
|
|
|
|
var minItem = dataset.min('x'); |
|
|
|
min = minItem ? util.convert(minItem.x, 'Date').valueOf() : null; |
|
|
|
// Note: we convert first to Date and then to number because else
|
|
|
|
// a conversion from ISODate to Number will fail
|
|
|
|
|
|
|
|
// calculate maximum value of fields 'start' and 'end'
|
|
|
|
var maxStartItem = dataset.max('x'); |
|
|
|
if (maxStartItem) { |
|
|
|
max = util.convert(maxStartItem.x, 'Date').valueOf(); |
|
|
|
for (var groupId in this.linegraph.groups) { |
|
|
|
if (this.linegraph.groups.hasOwnProperty(groupId)) { |
|
|
|
if (this.linegraph.groups[groupId].visible == true) { |
|
|
|
for (var i = 0; i < this.linegraph.groups[groupId].itemsData.length; i++) { |
|
|
|
var item = this.linegraph.groups[groupId].itemsData[i]; |
|
|
|
var value = util.convert(item.x, 'Date').valueOf(); |
|
|
|
min = min == null ? value : min > value ? value : min; |
|
|
|
max = max == null ? value : max < value ? value : max; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|