Charts: Add labels

This commit is contained in:
Aysam Guerler
2014-05-02 20:12:26 -04:00
parent cb176d2636
commit 6f98e04b60
2 changed files with 31 additions and 8 deletions
@@ -25,6 +25,7 @@ return Backbone.View.extend(
// default settings
optionsDefault: {
title : '',
pace : 1000,
margin : {
top : 50,
@@ -231,12 +232,32 @@ return Backbone.View.extend(
this.colSortOrder = false;
// build
this.rowLabels = this._buildRowLabels();
this.colLabels = this._buildColLabels();
this.heatMap = this._buildHeatMap();
this.legend = this._buildLegend();
this._buildRowLabels();
this._buildColLabels();
this._buildHeatMap();
this._buildLegend();
this._buildTitle();
},
// build title
_buildTitle: function() {
// link this
var self = this;
// gather data
var height = this.height;
var width = this.width;
var title = this.options.title;
// add title
this.svg.append('g')
.append('text')
.attr('x', width / 2)
.attr('y', height - 10)
.attr('text-anchor', 'middle')
.text(title);
},
// build legend
_buildLegend: function() {
// link this
@@ -22,12 +22,14 @@ return Backbone.View.extend(
for (var group_index in request_dictionary.groups) {
// get group
var group = request_dictionary.groups[group_index];
var div = self.options.canvas[group_index];
// draw plot
var heatmap = new HeatmapPlugin({
'colors' : HeatmapParameters.colorSets[chart.settings.get('color_set')],
'data' : group.values,
'div' : self.options.canvas[group_index]
'title' : group.key,
'colors' : HeatmapParameters.colorSets[chart.settings.get('color_set')],
'data' : group.values,
'div' : div
});
}