Update chart width/height -> Call redraw instead of render

67 views
Skip to first unread message

Amergin

unread,
Jul 22, 2015, 8:46:19 AM7/22/15
to dc-js user group
Is it possible to redraw a chart and have that chart's axes updated at the same time without using .render()?

My problem: the chart is inside a div that can be freely resized by user. When this happens, I expected updating the chart's width/height and redrawing would suffice:

          $scope.histogram.width( getWidth($scope.element) );
          $scope.histogram.height( getHeight($scope.element) );
          $scope.histogram.redraw();

What I see is now is that the chart base is redrawn with the new dimensions, but the containing <svg> element has the old width/height value. Furthermore, the axes are not updated. This can be fixed of course, by drawing the chart from scratch:

          $scope.histogram.width( getWidth($scope.element) );
          $scope.histogram.height( getHeight($scope.element) );
          $scope.histogram.render();

I would like to avoid using .render() because it basically 'does a little too much work' for a such minor adjustment, and there's no smooth transition. Is this possible? I see there are also undocumented methods renderXAxis and renderYAxis available, but calling them results in error.

Gordon Woodhull

unread,
Aug 5, 2015, 1:00:52 PM8/5/15
to dc-js user group
This is fixed in 2.0.0 beta 15, along with some other resizing bugs.
Reply all
Reply to author
Forward
0 new messages