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

Resize does not work correctly in latest version #67

Closed
danielytics opened this issue Apr 7, 2014 · 7 comments
Closed

Resize does not work correctly in latest version #67

danielytics opened this issue Apr 7, 2014 · 7 comments
Labels

Comments

@danielytics
Copy link

The code from the resize example worked in version 1.1.3 from the composite-axes branch, but when I upgraded to 1.2.0 it no longer works. It doesn't work in 1.1.6 either. I didn't try any other versions as I was using composite axes, but it looks like the example uses 1.1.5 without issue.

In 1.1.6 and 1.2.0, when resizing, it seems to recompute the sizes incorrectly causing bars (I only tested bar charts) to overlap and also the grid lines get distorted.

Currently, my work around is to destroy and recreate the charts every time the window size changes. This is obviously not ideal.

This is what my chart (correctly) looks like:
image

And this is what it looks like after resizing with one of the non-functioning versions (note the grid lines and the overlapped bars):

image

My code looks like this:

var chartsToResize = {};
$(window).resize(function(){
    for(var i in chartsToResize){
        chartsToResize[i].draw(0, true);
    }
});
function createChart (id,data){
    var svg = dimple.newSvg("#" + id, "100%", 305);
    var chart = new dimple.chart(svg, data);
    chart.setBounds(30, 10, "100%,-30px", "95%,-80px");
    var x = chart.addCategoryAxis("x", "Status");
    var y1 = chart.addMeasureAxis("y", "Current");
    var y2 = chart.addMeasureAxis(y1, "Previous");
    var series = chart.addSeries(" ", dimple.plot.bar, [x, y1]);
    chart.addSeries("", box, [x, y2]);
    chart.draw();
    chartsToResize[id] = chart;
}

(Note box is just a dimple.plot.bar with a fixed height - ie the red bars in the screenshots)

@johnkiernander
Copy link
Member

Thanks for flagging. 1.1.6 and 1.2 are interim versions. The code is not releasable yet, I still have a list of changes to make but it's very helpful that you raised this, I'll make sure it is fixed before release.

@danielytics
Copy link
Author

Do you have any ideas as to the timeline for the next release?

@johnkiernander
Copy link
Member

Hopefully this week, maybe next.

@danielytics
Copy link
Author

Awesome, thanks!

johnkiernander added a commit that referenced this issue Apr 7, 2014
@johnkiernander
Copy link
Member

This is still pending an actual release, but if you are using the working code this should now work correctly. I'll leave open until the release actually launches though.

@johnkiernander
Copy link
Member

FYI, release is still imminent, it turned into a major version change so I wanted to fit some other bits in meaning it got delayed. The code is almost all written now but there's a number of documentation changes to write and examples to add before I can release.

@johnkiernander
Copy link
Member

Fixed v2.0.0

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

2 participants