|
@ -361,12 +361,6 @@ LineGraph.prototype.setGroups = function (groups) { |
|
|
this._onUpdate(); |
|
|
this._onUpdate(); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Update the data |
|
|
|
|
|
* @param [ids] |
|
|
|
|
|
* @private |
|
|
|
|
|
*/ |
|
|
|
|
|
LineGraph.prototype._onUpdate = function (ids) { |
|
|
LineGraph.prototype._onUpdate = function (ids) { |
|
|
this._updateAllGroupData(); |
|
|
this._updateAllGroupData(); |
|
|
this.redraw(true); |
|
|
this.redraw(true); |
|
@ -385,7 +379,6 @@ LineGraph.prototype._onAddGroups = function (groupIds) { |
|
|
this._onUpdateGroups(groupIds); |
|
|
this._onUpdateGroups(groupIds); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* this cleans the group out off the legends and the dataaxis, updates the ungrouped and updates the graph |
|
|
* this cleans the group out off the legends and the dataaxis, updates the ungrouped and updates the graph |
|
|
* @param {Array} groupIds |
|
|
* @param {Array} groupIds |
|
@ -393,23 +386,31 @@ LineGraph.prototype._onAddGroups = function (groupIds) { |
|
|
*/ |
|
|
*/ |
|
|
LineGraph.prototype._onRemoveGroups = function (groupIds) { |
|
|
LineGraph.prototype._onRemoveGroups = function (groupIds) { |
|
|
for (var i = 0; i < groupIds.length; i++) { |
|
|
for (var i = 0; i < groupIds.length; i++) { |
|
|
if (this.groups.hasOwnProperty(groupIds[i])) { |
|
|
|
|
|
if (this.groups[groupIds[i]].options.yAxisOrientation == 'right') { |
|
|
|
|
|
this.yAxisRight.removeGroup(groupIds[i]); |
|
|
|
|
|
this.legendRight.removeGroup(groupIds[i]); |
|
|
|
|
|
this.legendRight.redraw(); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
this.yAxisLeft.removeGroup(groupIds[i]); |
|
|
|
|
|
this.legendLeft.removeGroup(groupIds[i]); |
|
|
|
|
|
this.legendLeft.redraw(); |
|
|
|
|
|
} |
|
|
|
|
|
delete this.groups[groupIds[i]]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this._removeGroup(groupIds[i]); |
|
|
} |
|
|
} |
|
|
this.redraw(true); |
|
|
this.redraw(true); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* this cleans the group out off the legends and the dataaxis |
|
|
|
|
|
* @param groupId |
|
|
|
|
|
* @private |
|
|
|
|
|
*/ |
|
|
|
|
|
LineGraph.prototype._removeGroup = function (groupId) { |
|
|
|
|
|
if (this.groups.hasOwnProperty(groupId)) { |
|
|
|
|
|
if (this.groups[groupId].options.yAxisOrientation == 'right') { |
|
|
|
|
|
this.yAxisRight.removeGroup(groupId); |
|
|
|
|
|
this.legendRight.removeGroup(groupId); |
|
|
|
|
|
this.legendRight.redraw(); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
this.yAxisLeft.removeGroup(groupId); |
|
|
|
|
|
this.legendLeft.removeGroup(groupId); |
|
|
|
|
|
this.legendLeft.redraw(); |
|
|
|
|
|
} |
|
|
|
|
|
delete this.groups[groupId]; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* update a group object with the group dataset entree |
|
|
* update a group object with the group dataset entree |
|
@ -485,12 +486,22 @@ LineGraph.prototype._updateAllGroupData = function () { |
|
|
var index= groupsContent[groupId].length - groupCounts[groupId]--; |
|
|
var index= groupsContent[groupId].length - groupCounts[groupId]--; |
|
|
groupsContent[groupId][index] = extended; |
|
|
groupsContent[groupId][index] = extended; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Make sure all groups are present, to allow removal of old groups
|
|
|
|
|
|
for (var groupId in this.groups){ |
|
|
|
|
|
if (this.groups.hasOwnProperty(groupId)){ |
|
|
|
|
|
if (!groupsContent.hasOwnProperty(groupId)) { |
|
|
|
|
|
groupsContent[groupId] = new Array(0); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//Update legendas, style and axis
|
|
|
//Update legendas, style and axis
|
|
|
for (var groupId in groupsContent) { |
|
|
for (var groupId in groupsContent) { |
|
|
if (groupsContent.hasOwnProperty(groupId)) { |
|
|
if (groupsContent.hasOwnProperty(groupId)) { |
|
|
if (groupsContent[groupId].length == 0) { |
|
|
if (groupsContent[groupId].length == 0) { |
|
|
if (this.groups.hasOwnProperty(groupId)) { |
|
|
if (this.groups.hasOwnProperty(groupId)) { |
|
|
this._onRemoveGroups([groupId]); |
|
|
|
|
|
|
|
|
this._removeGroup(groupId); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
var group = undefined; |
|
|
var group = undefined; |
|
@ -678,7 +689,7 @@ LineGraph.prototype._updateGraph = function () { |
|
|
if (group.options.shaded.orientation === "group") { |
|
|
if (group.options.shaded.orientation === "group") { |
|
|
var subGroupId = group.options.shaded.groupId; |
|
|
var subGroupId = group.options.shaded.groupId; |
|
|
if (groupIds.indexOf(subGroupId) === -1) { |
|
|
if (groupIds.indexOf(subGroupId) === -1) { |
|
|
console.log("Unknown shading group target given:" + subGroupId); |
|
|
|
|
|
|
|
|
console.log(group.id + ": Unknown shading group target given:" + subGroupId); |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
if (!paths.hasOwnProperty(subGroupId)) { |
|
|
if (!paths.hasOwnProperty(subGroupId)) { |
|
|