Allow to hide Y axis label

Allow to hide Y axis label and just show the lines.

Change-Id: Id79c9104104cf705e269aa97dc0748c0d976f46a
Closes-Bug: #1352269
This commit is contained in:
Ladislav Smola 2014-07-30 16:46:41 +02:00
parent 59e410eb24
commit 17d04a356d
1 changed files with 9 additions and 3 deletions

View File

@ -262,6 +262,7 @@ horizon.d3_line_chart = {
self.settings.auto_size = true;
self.settings.axes_x = true;
self.settings.axes_y = true;
self.settings.axes_y_label = true;
self.settings.interpolation = 'linear';
// Static y axes values
self.settings.yMin = undefined;
@ -309,7 +310,7 @@ horizon.d3_line_chart = {
var allowed_settings = ['renderer', 'auto_size', 'axes_x', 'axes_y',
'interpolation', 'yMin', 'yMax', 'xMin', 'xMax', 'bar_chart_settings',
'bar_chart_selector', 'composed_chart_selector',
'higlight_last_point'];
'higlight_last_point', 'axes_y_label'];
jQuery.each(allowed_settings, function(index, setting_name) {
if (settings[setting_name] !== undefined){
@ -512,9 +513,14 @@ horizon.d3_line_chart = {
axes_x.render();
}
if (self.settings.axes_y) {
var axes_y = new Rickshaw.Graph.Axis.Y({
var axes_y_settings = {
graph: graph
});
};
if (!self.settings.axes_y_label){
// hiding label of Y axis if setting is set to false
axes_y_settings.tickFormat = (function (d) { return ''; });
}
var axes_y = new Rickshaw.Graph.Axis.Y(axes_y_settings);
axes_y.render();
}