Hi, I made sfChart in this way:
KpiTwoChart = EmptyLinearChartBuilder(false, 0, from, to, "KpiTwoNoData");
FastLineSeries kpiTwoSeries = LineSeriesBuilder(Color.Navy);
KpiTwoChart.Series.Add(kpiTwoSeries);
kpiTwoSeries.ItemsSource = viewModel.KpiTwoData; //return a collection of data from REST service, Initially this collection is empty and it will be populated when datas arrive from server
implementation of EmptyLinearChartBuilder
public SfChart EmptyLinearChartBuilder(bool hasLegend, int TimePeriod, DateTime from, DateTime to, String isVisibileProperty)
{
NumericalAxis secondaryAxis = new NumericalAxis
{
RangePadding = NumericalPadding.Round,
Maximum = 110,
Minimum = -5,
MajorTickStyle = new ChartAxisTickStyle
{
TickSize = 3
},
EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift
};
var chart = new SfChart
{
VerticalOptions = LayoutOptions.FillAndExpand,
HorizontalOptions = LayoutOptions.FillAndExpand,
PrimaryAxis = new CategoryAxis
{
MaximumLabels = 3,
OpposedPosition = true,
LabelPlacement = LabelPlacement.BetweenTicks,
LabelStyle = new ChartAxisLabelStyle
{
LabelsPosition = AxisElementPosition.Inside
},
EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Shift,
MajorTickStyle = new ChartAxisTickStyle
{
TickSize = 0
},
ShowMajorGridLines = false
},
SecondaryAxis = secondaryAxis
};
if (hasLegend)
{
chart.Legend = new ChartLegend();
chart.Legend.DockPosition = LegendPlacement.Bottom;
chart.Legend.IconHeight = 20;
chart.Legend.IconWidth = 20;
chart.Legend.IsVisible = true;
chart.Legend.IsIconVisible = true;
}
chart.SecondaryAxis.LabelCreated += SecondaryAxis_LabelCreated;
if (!String.IsNullOrEmpty(isVisibileProperty))
{
NumericalStripLine noData = new NumericalStripLine
{
Text = "No Data",
Start = -5,
Width = 110,
FillColor = Color.Transparent
};
noData.SetBinding(NumericalStripLine.IsVisibleProperty, new Binding(isVisibileProperty));
noData.BindingContext = viewModel;
secondaryAxis.StripLines.Add(noData);
}
return chart;
}
What happen is this, when I load chars for first time it is correctly rendered but if I put application in background and open it again Line series disappear, and when i press button to reload data series appear agian, I couldn't understand wehere is the problem and why this happen, I also try to bind line series with source of data but nothing, The problem appear only on tablet on Android. I hope anyone could help me, thank you.