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

composite chart always uses elasticY() #1056

Closed
haayman opened this issue Dec 4, 2015 · 9 comments
Closed

composite chart always uses elasticY() #1056

haayman opened this issue Dec 4, 2015 · 9 comments

Comments

@haayman
Copy link

haayman commented Dec 4, 2015

I cannot convince my composite chart NOT to use an elastic Y-axis

I've got a composite chart. 2 charts use the left y-axis, which should have a domain([0,10]), the right-axis is preferably elastic, but the issue occurs also when I give it a domain

in short:

chart1 = dc.lineChart( _chart )
.y( d3.scale.linear().domain([0,10])
.elasticY( false )

chart2 = dc.lineChart( _chart )
.y( d3.scale.linear().domain([0,10])
.elasticY( false )

chart3 = dc.lineChart( _chart )
.y( d3.scale.linear().domain([0, maxValue])
.elasticY( false )
.useRightYAxis(true)

combo = dc.compositeChart( element )
.compose( [chart1,chart2,chart3])

Still both axes are elastic.
After some debugging I found this (line 2459 in dc.2.0.0-beta.5)

_chart._prepareYAxis = function (g) {
if (_y === undefined || _chart.elasticY())

_y always is undefined, even though I've set .y() for all charts

@gordonwoodhull
Copy link
Contributor

You need to set it for the composite chart. Everything is top-down in the composite chart.

@haayman
Copy link
Author

haayman commented Dec 4, 2015

I've done that too. Forgot to set that in the code above.
What I find weird in the code that _y seems a global variable, so I guess something in the order of defining charts screws this up?

@gordonwoodhull
Copy link
Contributor

Or, more precisely, the domain is shared between the charts of a composite: calculated on the parent based on the children, and then passed down to the children.

@gordonwoodhull
Copy link
Contributor

Nope, no globals. If you can share a full example I can help you track it down. I'm pretty sure it's not a bug in dc.js.

@haayman
Copy link
Author

haayman commented Dec 4, 2015

I'm afraid the site is password protected

@haayman
Copy link
Author

haayman commented Dec 4, 2015

If all charts already have an domain set, what's to be calculated?

@gordonwoodhull
Copy link
Contributor

Can't help you without working code to look at, sorry.

Sorry, but the issue tracker is for reporting bugs and making enhancement requests, not for general support questions. Please ask on Stack Overflow with the dc.js tag, or on the user group, and we will be glad to help you there.

I am closing this.

@gordonwoodhull
Copy link
Contributor

Apologies, I closed this too fast. I created a test case using the composite example and indeed, the domain is overwritten by the elasticY even when elasticY is not enabled.

It's a bug I introduced in beta 20 (2dd561f) when working on resizing issues. The y scale domain should not be set when resizing, only the range.

@gordonwoodhull gordonwoodhull reopened this Dec 4, 2015
gordonwoodhull added a commit that referenced this issue Dec 4, 2015
@gordonwoodhull
Copy link
Contributor

Fixed on master; will be fixed in beta 23 later today.

gazal-k added a commit to gazal-k/dc.js that referenced this issue Dec 6, 2015
gordonwoodhull pushed a commit that referenced this issue Jul 14, 2016
gordonwoodhull pushed a commit that referenced this issue Jul 19, 2016
gordonwoodhull pushed a commit that referenced this issue Jul 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants