Skip to content
This repository has been archived by the owner on Nov 2, 2021. It is now read-only.

Grouped (horizontal/vertical, stacked) bar charts not responsive #20

Open
mattsrinc opened this issue Jul 22, 2018 · 0 comments
Open

Grouped (horizontal/vertical, stacked) bar charts not responsive #20

mattsrinc opened this issue Jul 22, 2018 · 0 comments

Comments

@mattsrinc
Copy link

mattsrinc commented Jul 22, 2018

Hi, enjoying D3Kit library and started to create reusable chart components that work fine for pie and line charts (line chart needs adjustment if line is animated through data points progressively since it doesn't fill entire line when chart is resized - that's another issue).

But for advanced bar charts I cannot achieve responsiveness - axes resize as they should but the data e.g. bars don't adjust when a browser is resized (e.g. x(d.value) should be different for resized bars but the code part to draw bars doesn't get called on resize).

Attaching stripped sample code (BCGH.html), JSON data file and a page (test-BCGH.html) without using D3Kit for horizontal grouped bar charts (the same issue is with usual vertical and stacked bar charts that also don't reposition as they should - simple bar charts resize fine with D3Kit). Note that direct comparison of these pages is not fair since in the test-BCGH SVG itself resizes to the container.

I have tried to change the onresize function in various ways:

  • getting ID of the current chart (this.container._groups[0][0].id)) and do some cleaning but of course the chart content cannot be deleted (e.g. clearing the entire DIV as here:
    http://bl.ocks.org/ChandrakantThakkarDigiCorp/f0e2cf699d9b96aa09e283550bfef1e4 );
  • removing SVG width and height attributes to have it autoresize but then D3Kit must be handled well (e.g. the plate dimensions, changing to be done with having fit options set);
  • involving timer function to somehow wait for onresize event to complete (and then call the visualize function again).

Any help much appreciated.

D3Kit-hori-grouped-bar-charts.zip

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant