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

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

@mattsrinc

Description

@mattsrinc

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions