Skip to content

Commit

Permalink
Fix for 2-axis charts where it shrinks them a little bit
Browse files Browse the repository at this point in the history
  • Loading branch information
BradBaker committed Jan 8, 2016
1 parent eafd438 commit 98809cb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
7 changes: 0 additions & 7 deletions panoramix/static/panoramix.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,6 @@ var px = (function() {
current_col = $(this).attr('data-col');
$( this ).css('z-index', 100 - current_col);
});

// this makes the whole chart fit within the dashboard div
$(".slice_container > svg").each(function(index){
w = $( this ).width();
h = $( this ).height();
$( this ).get(0).setAttribute('viewBox', '0 0 '+w+' '+(h+30));
});
}

// Export public functions
Expand Down
9 changes: 8 additions & 1 deletion panoramix/static/widgets/viz_nvd3.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function viz_nvd3(slice) {
nv.addGraph(function() {
if (viz_type === 'line') {
if (viz.form_data.show_brush) {
chart = nv.models.lineWithFocusChart()
chart = nv.models.lineWithFocusChart();
//chart.lines2.xScale( d3.time.scale.utc());
chart.lines2.xScale(d3.time.scale.utc());
chart.x2Axis
Expand Down Expand Up @@ -167,6 +167,13 @@ function viz_nvd3(slice) {
.datum(data.chart_data)
.transition().duration(500)
.call(chart);
// if it is a two axis chart, rescale it down just a little so it fits in the div.
if(chart.hasOwnProperty("x2Axis")) {
two_axis_chart = $(slice.selector + " > svg");
w = two_axis_chart.width();
h = two_axis_chart.height();
two_axis_chart.get(0).setAttribute('viewBox', '0 0 '+w+' '+(h+30));
}

return chart;
});
Expand Down

0 comments on commit 98809cb

Please sign in to comment.