I have a Xamarin forms Project with one page of my app containing a SciChart. On that page, I have a RelativeLayout.
In the code behind for that page, I pass my layout to a dependency service method which adds the SciChartSurface to it depending on the platform. This has tested well on various Android platforms.
For iOS, I’ve tested on a device running iOS 9 and simulators running 9, 10, and 11. And any run less than 11 does not display. The view is simply blank.
Here’s the code where I add the SciChartSurface to the view.. I’m still new to SciChart, so I’m not sure if I’m doing everything totally correct.
public void renderSciChart(Xamarin.Forms.RelativeLayout masterLayout, Xamarin.Forms.RelativeLayout topLayout)
{
SciChart.iOS.Charting.SCIChartSurface Surface = new SciChart.iOS.Charting.SCIChartSurface();
Surface.TranslatesAutoresizingMaskIntoConstraints = true;
SciChart.iOS.Charting.XyDataSeries<double, double> dataSeries = new SciChart.iOS.Charting.XyDataSeries<double, double>();
//generateDataPoints(dataSeries);
var xAxis = new SciChart.iOS.Charting.SCINumericAxis{/*GrowBy = new SciChart.iOS.Charting.SCIDoubleRange(0.1, 0.1), VisibleRange = new SciChart.iOS.Charting.SCIDoubleRange(1.1,2.7)*/};
var yAxis = new SciChart.iOS.Charting.SCINumericAxis();
var renderableSeries = new SciChart.iOS.Charting.SCIFastLineRenderableSeries { DataSeries = dataSeries, StrokeStyle = new SciChart.iOS.Charting.SCISolidPenStyle(0xFF279B27, 2f) };
using (Surface.SuspendUpdates())
{
Surface.XAxes.Add(xAxis);
Surface.YAxes.Add(yAxis);
Surface.RenderableSeries.Add(renderableSeries);
Surface.ChartModifiers = new SciChart.iOS.Charting.SCIChartModifierCollection
{
new SciChart.iOS.Charting.SCIZoomPanModifier(),
new SciChart.iOS.Charting.SCIPinchZoomModifier(),
new SciChart.iOS.Charting.SCIZoomExtentsModifier(),
};
}
masterLayout.Children.Add(Surface.ToView(),
widthConstraint: Constraint.RelativeToParent(parent => parent.Width),
heightConstraint: Constraint.RelativeToParent(parent => parent.Height * 0.5),
yConstraint: Constraint.RelativeToView(topLayout, (RelativeLayout, element) => element.Height));
}
Additionally, here’s a Screenshot of the same code running on a simulator with iOS 10 (Left) and iOS 11 (Right).
- Nicholas Provost asked 6 years ago
- last edited 6 years ago
-
Update: v2.1.0.614 has been published to NuGet. Can you try it?
-
Thanks for the prompt update! I’m at work but I will try it in a few hours when I get home and let you know!
-
@Andrew Thank you very much. It works! I tested iOS 9 (real device) and iOS 10 (simulator).
- You must login to post comments
Hi Nicolas,
We had a similar issue reported for SciChart iOS native: devices running iOS 8, 9, 10 would not show charts, but iOS 11 would.
This has been fixed in our internal build and has been published to Cocoapod for users using ScIChart iOS in native apps.
For Xamarin, we have to re-run our binding generator and publish to NuGet. This build job is queued to run today. If all tests pass it will be published to NuGet before the end of the day. Look for version 2.1.0.614 (or greater) of SciChart.IOS on our NuGet feed.
Best regards,
Andrew
- Andrew Burnett-Thompson answered 6 years ago
-
@Andrew Thank you very much. It works! I tested iOS 9 (real device) and iOS 10 (simulator).
-
Superb! Thanks for letting me know! Best regards, Andrew
- You must login to post comments
Please login first to submit.