Skip to content

Commit

Permalink
tweaks and bug fixes to horizontal bar support
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-jones committed Sep 7, 2014
1 parent 007fc23 commit e466d0f
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions jquery.reportview.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,22 +213,27 @@ function renderHorizontalMultiBar(params) {
var data_series = params.data_series
var selector = params.svg_selector
var options = params.options

var show_values = options.horizontal_multibar_show_values
var tool_tips = options.horizontal_multibar_tool_tips
var controls = options.horizontal_multibar_controls
var y_tick_format = options.horizontal_multibar_y_tick_format
var transition_duration = options.horizontal_multibar_transition_duration

nv.addGraph(function() {
var chart = nv.models.multiBarHorizontalChart()
.x(function(d) { return d.label })
.y(function(d) { return d.value })
// .margin({top: 30, right: 20, bottom: 50, left: 175})
.showValues(true)
.tooltips(false)
.showControls(false);
.showValues(show_values)
.tooltips(tool_tips)
.showControls(controls);

chart.yAxis
.tickFormat(d3.format(',.2f'));
.tickFormat(d3.format(y_tick_format));

d3.select(selector)
.datum(data_series)
.transition().duration(500)
.transition().duration(transition_duration)
.call(chart);

nv.utils.windowResize(chart.update);
Expand Down Expand Up @@ -269,8 +274,13 @@ function renderHorizontalMultiBar(params) {
"multibar_transition_duration" : 500,

// convert/render functions for horizontal bar chart
"horizontal_multibar_render" : renderHoriztonalMultiBar,
"horizontal_multibar_render" : renderHorizontalMultiBar,
"horizontal_multibar_convert" : convertHorizontalMultiBar,
"horizontal_multibar_show_values" : true,
"horizontal_multibar_tool_tips" : true,
"horizontal_multibar_controls" : false,
"horizontal_multibar_y_tick_format" : ',.0f',
"horizontal_multibar_transition_duration" : 500,

// data from which to build the graph
"data_series" : false,
Expand Down Expand Up @@ -530,7 +540,7 @@ function renderHorizontalMultiBar(params) {
}

// convert and render the series
var series = convertFn({"data_series" : data_series})
var series = convertFn({"data_series" : options.data_series})
renderFn({
"context" : obj,
"data_series" : series,
Expand Down

0 comments on commit e466d0f

Please sign in to comment.