Merge branch 'master' into gh-pages
This commit is contained in:
@@ -15,7 +15,8 @@ this.recline.View = this.recline.View || {};
|
|||||||
// {
|
// {
|
||||||
// group: {column name for x-axis},
|
// group: {column name for x-axis},
|
||||||
// series: [{column name for series A}, {column name series B}, ... ],
|
// 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
|
// NB: should *not* provide an el argument to the view but must let the view
|
||||||
@@ -247,7 +248,14 @@ my.Graph = Backbone.View.extend({
|
|||||||
},
|
},
|
||||||
grid: { hoverable: true, clickable: true }
|
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() {
|
createSeries: function() {
|
||||||
|
|||||||
@@ -69,3 +69,18 @@ test('GraphControls basics', function () {
|
|||||||
view.remove();
|
view.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Overriding graph options', function () {
|
||||||
|
var dataset = Fixture.getDataset();
|
||||||
|
var randomWidth = Math.random();
|
||||||
|
var view = new recline.View.Graph({
|
||||||
|
model: dataset,
|
||||||
|
state: {
|
||||||
|
'graphType': 'bars',
|
||||||
|
'group': 'date',
|
||||||
|
'series': ['y', 'z'],
|
||||||
|
'graphOptions': { bars: {barWidth: randomWidth}}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
equal(view.getGraphOptions('bars').bars.barWidth, randomWidth)
|
||||||
|
view.remove();
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user