Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

various charts don't fit with auto-height and unsized div #1070

Closed
gordonwoodhull opened this issue Dec 21, 2015 · 4 comments
Closed

various charts don't fit with auto-height and unsized div #1070

gordonwoodhull opened this issue Dec 21, 2015 · 4 comments
Labels
Milestone

Comments

@gordonwoodhull
Copy link
Contributor

When using the feature to automatically determine the chart size (by not setting width/height or setting them to null), and the containing div does not have an absolute size, the size of the pie can be calculated wrong and it gets clipped:

image

<div id="test"></div>
var chart = dc.pieChart("#test");
  chart
    .slicesCap(4)
    .innerRadius(50)
    .dimension(runDimension)
    .group(speedSumGroup)
    .legend(dc.legend());

This is because the SVG size is based on the div, then the div sizes to the SVG, and then when .height() gets read again in order to set the radius, now the auto-height is a little bigger.

@gordonwoodhull gordonwoodhull added this to the v2.0 milestone Dec 21, 2015
@gordonwoodhull gordonwoodhull changed the title pie chart doesn't fit with auto-heightand unsized div pie chart doesn't fit with auto-height and unsized div Dec 21, 2015
@gordonwoodhull
Copy link
Contributor Author

Even worse if there's other stuff in the div (like controls)

image

@gordonwoodhull
Copy link
Contributor Author

Similarly with the row chart:

image

<div id="chart-row-spenders">
<p>Some Controls.</p></div>
var spenderRowChart = dc.rowChart("#chart-row-spenders");
spenderRowChart
    .dimension(nameDim)
    .group(spendPerName)
    .elasticX(true);

@gordonwoodhull
Copy link
Contributor Author

heatmap (data goes to 1985 and x axis should be displayed)

image

<div id="heatmap"><h1>blah</h1></div>

& no width/height in initialization of heatmap.

@gordonwoodhull gordonwoodhull changed the title pie chart doesn't fit with auto-height and unsized div various charts don't fit with auto-height and unsized div Dec 21, 2015
@gordonwoodhull
Copy link
Contributor Author

Solution: only calculate the size once per render. Fixed in 2.0 beta 24.

gordonwoodhull added a commit that referenced this issue Dec 21, 2015
we don't know the actual sizes here
the main point is the failing redraw test for #980/#1070
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant