I have a question about an apparent regression/change from v2 to v4.
My chart uses an SCIHorizontallyStackedColumnsCollection with three SCIStackedColumnRenderableSeries instances. One of those is assigned to the right-hand Y axis, and the other two are assigned to the left-hand Y axis. Left and right Y axes have very different ranges.
In v2, each series in the group honored its assigned axis. In v4, each series is using the scale of the left-hand Y axis. This happens regardless of the order I add the renderable series to the columns collection.
In the example below, the magenta, blue, and yellow bars have a range of -2 to 2, and are assigned to the left-hand axis. The green bars have a range of 0 to 30 and are assigned to the right-hand axis. I expect all 4 bars to be displayed using the full vertical range of the chart, but instead everything is using the left-hand axis, and the non-green bars have very little displacement.
This is a change in behavior from v2 to v4. Is it intentional? Is there an easy workaround?
I tried to hack around it by having two different SCIStackedColumnRenderableSeries instances, one with 3 placeholder series/1 real series (RH axis) and the other with 1 placeholder/3 real series (LH axis). That doesn’t help. If there are two different column collections on the chart, they both use the left-hand axis, regardless of the order that they are added.
Minimal repro case is attached. But the crux is at the end. If I comment out the .add(rightStacks) call, I get desired behavior for the stack assigned to the left axis. If I comment out the .add(leftStacks), I get desired behavior for the stack assigned to the right axis. What I want is the chart I’d get by overlaying the second and third screenshots, but with the 0 point of left and right Y axis aligned.
let rightStacks = SCIHorizontallyStackedColumnsCollection() rightStacks.add(rsRightPlaceholder1) rightStacks.add(rsRightPlaceholder2) rightStacks.add(rsRightPlaceholder3) rightStacks.add(rsRight) surface.renderableSeries.add(rightStacks) let leftStacks = SCIHorizontallyStackedColumnsCollection() leftStacks.add(rsLeftSine) leftStacks.add(rsLeftSingle) leftStacks.add(rsLeftDouble) leftStacks.add(rsLeftPlaceholder) surface.renderableSeries.add(leftStacks)
I think I’ve found the cause.
If I manually set (at line 46) yAxisLeft.axisId = “yAxisMyLeft”, then when I render, I get this in the console log:
2021-03-10 16:02:07.993233-0800 SciChart POC[86749:4815412] [WARNING] – [Render Warnings] Could not draw a renderable series of type SCIHorizontallyStackedColumnsCollection. YAxis with Id == DefaultAxisId doesn’t exist. Please ensure that the YAxisId property is set to a valid value.
2021-03-10 16:02:08.509648-0800 SciChart POC[86749:4815412] [WARNING] – [Render Warnings] Could not draw a renderable series of type SCIHorizontallyStackedColumnsCollection. YAxis with Id == DefaultAxisId doesn’t exist. Please ensure that the YAxisId property is set to a valid value.
I conclude from this behavior that SCIHorizontallyStackedColumnsCollection is hardwired to the default axis internally, regardless of the settings of the collection members.
- The magenta, blue, and yellow bars have a range of -2 to 2 and are assigned to the left-hand axis. The green bars have a range of 0 to 30 and are assigned to the right-hand axis. I expect all 4 bars to be displayed using the full vertical range of the chart, but instead, everything is using the left-hand axis, and the non-green bars have very little displacement. By: https://mycalcu.com/
- You must login to post comments
First of we fixed few issues in stacked series recently, so if you’d like to try that out you will need to update to v4.2.0-nightly.5585 through the nightly build, which is available through CocoaPods or SwiftPM.
From here, please see the code in the attached file as well as attached screenshot.
There’s no way of having stacked series in a collection bound to different Y axes, that brings a lot of issues with ranging, hit-test etc. So without heavy refactoring of stacked series from the ground-up it can’t be achieved out of the box.
But this could be achieved via workaround you mentioned previously, you will need to mirror your series which differ and make them transparent to occupy needed stacking space.
Please see the code, try if out and let us know if that’s suitable for you.
Lead SciChart iOS Developer
// SciChart News
// SciChart has won the Queens Award For Enterprise in the Innovation category! – https://www.scichart.com/queens-award-innovation
// SciChart receives Highly Commended in National Business Awards! – https://www.scichart.com/lloyds-innovation-award
// SciChart Mobile SDK v3 / WPF SDK v6 released! – https://www.scichart.com/scichart-mobile-sdk-v3-0-0-released
// Over 320 SciChart Reviews! – https://www.reviews.co.uk/company-reviews/store/scichart-com
- You must login to post comments
Please login first to submit.