We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Lineseries doesn't appear correctly

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.

6 Replies

PS Parthiban Sundaram Syncfusion Team March 24, 2017 06:55 PM UTC

Hi Amro,

Thanks for using Syncfusion products.

If the back button is pressed, the Android activity will be destroyed. Hence when you open it from the background apps, the application will start from initial point (same like closing and opening the application again).

Reference link: https://forums.xamarin.com/discussion/87092/back-button-closes-app-but-not-the-rest-of-the-application

But this should work when you put your application in background by pressing home button. If you are facing issue in this case too, we kindly request you to provide the device/OS details which will be helpful for providing further assistance on this.

Please let us know, if your issue is different from this.

Regards,
Parthiban S



AM Amro March 27, 2017 01:07 PM UTC

Dell venue 8 Android 5.1


AM Amro March 28, 2017 06:47 AM UTC

Lines sometime doesn't appera also at first lounch of application


SP Saravana Pandian Murugan Syncfusion Team March 28, 2017 05:01 PM UTC

Hi Amro,

Thanks for the update.

We kindly request you to confirm whether you put the application in background by pressing the home button. If so, please check whether you are able to reproduce the issue (while clicking home button and resume, application refreshes) in the attached sample.

Regarding "Lines sometime doesn't appear also at first launch of application",

We are unable to reproduce the reported issue at our end and we have prepared a sample as per your requirement. Please update us the modified sample to reproduce the issue which will be helpful for providing further assistance on this.

Sample : http://www.syncfusion.com/downloads/support/forum/129520/ze/ChartSample451750506

Regards,
Saravana Pandian M.



AM Amro March 29, 2017 07:02 AM UTC

I put the application in background by pressing home button, I'm not able to reproduce the issue in the attached sample, Thank you for helping me.


SP Saravana Pandian Murugan Syncfusion Team March 30, 2017 04:19 PM UTC

Hi Amro,

Thanks for your update.

If you are still facing this issue in your application, could you please update us the modified sample with the issue you are facing which will be helpful to assist you further on this and provide you a solution..

Regards,
Saravana Pandian M.


Loader.
Live Chat Icon For mobile
Up arrow icon