kylegetz
Posts: 141
Joined: Tue Oct 11, 2011 10:24 pm

Need help with working with multiple panes

Hi,

I'm trying to create a Highstock chart with multiple panes, such as in this demo: http://www.highcharts.com/stock/demo/ca ... and-volume

I'm running into some problems relating to the size and positions of the panes. In the demo, the height of the panes and the offset of the bottom pane are all specified statically; this works well enough because the height of the entire chart is also specified statically. However, what if the height of the chart is calculated at runtime? How are we supposed to calculate the proper heights and offsets? I've tried implementing the pixel calculations myself, but they doesn't work quite right because Highstock adds padding/margins to various places and I don't think there's a way for me to "get" that information. I've been able to fudge the calculations enough such that the second pane is positioned well enough in Firefox, but then in IE the position is wrong.

I'll also point out that even when specifying all the measurements statically, there's still room for error, and there actually is an error in the demo: in the lower pane, there is a gap between the bottoms of the red bars and the x-axis when there shouldn't be a gap. This doesn't bode well for me trying to calculate these measurements dynamically. :D

Ideally, I'd like the API to be structured such that I can tell Highstock that I want multiple panes, with the first pane to be x% of the available vertical space and the second pane to be y% of the available vertical space, then have Highstock do the actual layout for me. Is this possible? If not, what's the best way to approach this scenario?

Many thanks,
Kyle
dimchez
Posts: 12
Joined: Fri Dec 16, 2011 3:07 pm

Re: Need help with working with multiple panes

Hi,

Take a look at this thread http://highslide.com/forum/viewtopic.php?f=12&t=15433 - it might be relevant to your issue.
kylegetz
Posts: 141
Joined: Tue Oct 11, 2011 10:24 pm

Re: Need help with working with multiple panes

dimchez wrote:Hi,

Take a look at this thread http://highslide.com/forum/viewtopic.php?f=12&t=15433 - it might be relevant to your issue.
It's sort of relevant, but that demo is solving a much simpler problem. The demo page has all the axis height and top values hardcoded already and then it just slides them around. I'm trying to figure out how to dynamically calculate all the axis height and top settings without hardcoding anything (other than the chart's height).
hfrntt
Posts: 6393
Joined: Mon Aug 30, 2010 8:41 am
Contact: Website

Re: Need help with working with multiple panes

I posted fixed demo in the other topic (http://highslide.com/forum/viewtopic.php?p=68570#p68570) so does it solve your problem? If not, at which point you know axes height and top value?
Slawek Kolodziej
Highcharts support team
kylegetz
Posts: 141
Joined: Tue Oct 11, 2011 10:24 pm

Re: Need help with working with multiple panes

I worked on this a bit and figured out the pixel math such that I can have two panes of data with any chart height and it looks quite decent (though I still wish Highstock made this easier). However, I do have one follow-up question for you. If you look at the screenshot I've attached, you can see that the x-axis gridlines still pass through the space between the two panes. Is there any way to disable this?
Screenshot of dual-pane layout
Screenshot of dual-pane layout
dual-pane-layout.png (38.65 KiB) Viewed 3781 times
hfrntt
Posts: 6393
Joined: Mon Aug 30, 2010 8:41 am
Contact: Website

Re: Need help with working with multiple panes

I made a workaround for this one too :) See: http://highslide.com/forum/viewtopic.php?f=12&t=14437

Anyway I can agree, it'd be better to have this out of the box.
Slawek Kolodziej
Highcharts support team
kylegetz
Posts: 141
Joined: Tue Oct 11, 2011 10:24 pm

Re: Need help with working with multiple panes

Haha, I see what you did there. I guess that workaround will have to do for me too. :D

Return to “Highcharts Stock”