Merge pull request #272 from demiurg/master

[view/graph][s]: Ability to extend graph options with general options - thx to @demiurg.
This commit is contained in:
Rufus Pollock
2012-11-10 00:44:05 -08:00
2 changed files with 26 additions and 3 deletions

View File

@@ -15,9 +15,10 @@ this.recline.View = this.recline.View || {};
// {
// group: {column name for x-axis},
// series: [{column name for series A}, {column name series B}, ... ],
// graphType: 'line'
// graphType: 'line',
// graphOptions: {custom [Flotr2 options](http://www.humblesoftware.com/flotr2/documentation#configuration)}
// }
//
//
// NB: should *not* provide an el argument to the view but must let the view
// generate the element itself (you can then append view.el to the DOM.
my.Graph = Backbone.View.extend({
@@ -247,7 +248,14 @@ my.Graph = Backbone.View.extend({
},
grid: { hoverable: true, clickable: true }
};
return optionsPerGraphType[typeId];
if (self.state.get('graphOptions')){
return _.extend(optionsPerGraphType[typeId],
self.state.get('graphOptions')
)
}else{
return optionsPerGraphType[typeId];
}
},
createSeries: function() {