|
@ -16,7 +16,7 @@ var Points = require('./graph2d_types/points'); |
|
|
*/ |
|
|
*/ |
|
|
function GraphGroup(group, groupId, options, groupsUsingDefaultStyles) { |
|
|
function GraphGroup(group, groupId, options, groupsUsingDefaultStyles) { |
|
|
this.id = groupId; |
|
|
this.id = groupId; |
|
|
var fields = ['sampling', 'style', 'sort', 'yAxisOrientation', 'barChart', 'drawPoints', 'shaded', 'interpolation']; |
|
|
|
|
|
|
|
|
var fields = ['sampling', 'style', 'sort', 'yAxisOrientation', 'barChart', 'drawPoints', 'shaded', 'interpolation', 'zIndex']; |
|
|
this.options = util.selectiveBridgeObject(fields, options); |
|
|
this.options = util.selectiveBridgeObject(fields, options); |
|
|
this.usingDefaultStyle = group.className === undefined; |
|
|
this.usingDefaultStyle = group.className === undefined; |
|
|
this.groupsUsingDefaultStyles = groupsUsingDefaultStyles; |
|
|
this.groupsUsingDefaultStyles = groupsUsingDefaultStyles; |
|
@ -29,17 +29,6 @@ function GraphGroup(group, groupId, options, groupsUsingDefaultStyles) { |
|
|
this.visible = group.visible === undefined ? true : group.visible; |
|
|
this.visible = group.visible === undefined ? true : group.visible; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function insertionSort (a,compare) { |
|
|
|
|
|
for (var i = 0; i < a.length; i++) { |
|
|
|
|
|
var k = a[i]; |
|
|
|
|
|
for (var j = i; j > 0 && compare(k,a[j - 1])<0; j--) { |
|
|
|
|
|
a[j] = a[j - 1]; |
|
|
|
|
|
} |
|
|
|
|
|
a[j] = k; |
|
|
|
|
|
} |
|
|
|
|
|
return a; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* this loads a reference to all items in this group into this group. |
|
|
* this loads a reference to all items in this group into this group. |
|
|
* @param {array} items |
|
|
* @param {array} items |
|
@ -48,7 +37,7 @@ GraphGroup.prototype.setItems = function (items) { |
|
|
if (items != null) { |
|
|
if (items != null) { |
|
|
this.itemsData = items; |
|
|
this.itemsData = items; |
|
|
if (this.options.sort == true) { |
|
|
if (this.options.sort == true) { |
|
|
insertionSort(this.itemsData,function (a, b) { |
|
|
|
|
|
|
|
|
util.insertSort(this.itemsData,function (a, b) { |
|
|
return a.x > b.x ? 1 : -1; |
|
|
return a.x > b.x ? 1 : -1; |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
@ -76,7 +65,7 @@ GraphGroup.prototype.setZeroPosition = function (pos) { |
|
|
*/ |
|
|
*/ |
|
|
GraphGroup.prototype.setOptions = function (options) { |
|
|
GraphGroup.prototype.setOptions = function (options) { |
|
|
if (options !== undefined) { |
|
|
if (options !== undefined) { |
|
|
var fields = ['sampling', 'style', 'sort', 'yAxisOrientation', 'barChart', 'excludeFromLegend', 'excludeFromStacking']; |
|
|
|
|
|
|
|
|
var fields = ['sampling', 'style', 'sort', 'yAxisOrientation', 'barChart', 'excludeFromLegend', 'excludeFromStacking', 'zIndex']; |
|
|
util.selectiveDeepExtend(fields, this.options, options); |
|
|
util.selectiveDeepExtend(fields, this.options, options); |
|
|
|
|
|
|
|
|
// if the group's drawPoints is a function delegate the callback to the onRender property
|
|
|
// if the group's drawPoints is a function delegate the callback to the onRender property
|
|
|