Charts: Add title to configuration panel

This commit is contained in:
Aysam Guerler
2014-03-08 02:12:43 -05:00
parent 7d90d4c1a0
commit ecaea7332f
4 changed files with 27 additions and 3 deletions
@@ -9,8 +9,17 @@ return $.extend(true, {}, nvd3_config, {
}
},
settings : {
x_axis_label : {
init : 'Breaks'
},
y_axis_label : {
init : 'Density'
},
y_axis_tick : {
init : '.3'
},
separator_custom : {
title : 'Histogram settings',
title : 'Advanced',
type : 'separator'
},
bin_size : {
@@ -8,17 +8,23 @@ var View = Backbone.View.extend(
// initialize
initialize: function(options) {
// ui elements
this.table_title = new Ui.Label({title: options.title});
this.table = new Table({content: options.content});
// create element
var $view = $('<div/>');
$view.append(Utils.wrap((new Ui.Label({title: options.title})).$el));
$view.append(Utils.wrap(this.table_title.$el));
$view.append(Utils.wrap(this.table.$el));
// add element
this.setElement($view);
},
// title
title: function(new_title) {
this.table_title.title(new_title);
},
// update
update: function(settings, model) {
// reset table
@@ -18,6 +18,11 @@ var Label = Backbone.View.extend(
this.setElement(this._template(this.options));
},
// title
title: function(new_title) {
this.$el.find('b').html(new_title);
},
// template
_template: function(options) {
return '<label><b>' + options.title + '</b></label>';
@@ -40,9 +40,13 @@ return Backbone.View.extend(
if (!chart_type) {
return;
}
// get settings
var chart_definition = this.app.types.get(chart_type);
// set title
this.form.title(chart_definition.title + ':');
// update table form model
var chart_definition = this.app.types.get(chart_type);
this.form.update(chart_definition.settings, this.chart.settings);
}
});