Monodroid:当我滚动视图时,TeeCharts消失

时间:2013-07-09 11:45:05

标签: android xamarin.android teechart

我应该在运行时添加4个teechart控件。我能够将值绑定到teechart控件。

问题是,当我滚动父视图时,所有teecharts都会消失。但所有其他控件都是可见的(按钮,textview等)。

注意:最初所有控件都是可见的;只有当我滚动时它们才会消失。

void drawRainfallChart()

    {
        try
        {
            obj = new csGraphClass();
            RainfallGraph[] graphdata = obj.getRainfallData(_cropId.ToString());
            if (rainfallChart == null)
                rainfallChart = new Steema.TeeChart.TChart(this);
            else
            {
                rainfallChart.RemoveAllViews();
                rainfallChart.Dispose();
                rainfallChart = new Steema.TeeChart.TChart(this);
            }
            if (graphdata.Length > 0)
            {
                rainfallChart.Aspect.View3D = false;
                rainfallChart.Chart.Invalidate();
                Steema.TeeChart.Styles.Line rline = new Steema.TeeChart.Styles.Line();
                Steema.TeeChart.Styles.Line rCrtdayline = new Steema.TeeChart.Styles.Line();
                rainfallChart.Series.Add(rline);
                rainfallChart.Series.Add(rCrtdayline);
                DateTime currentdate = SyncProcess.CalculatedDatetime();
                double dc = 0;
                foreach (RainfallGraph item in graphdata)
                {
                    dc += Convert.ToDouble(item.yValue);
                    rline.Add(Convert.ToDateTime(item.xValue), dc);
                    if (item.xValue == currentdate.ToString("yyyy-MM-dd"))
                    {
                        rCrtdayline.Add(Convert.ToDateTime(item.xValue), 0);
                        rCrtdayline.Add(Convert.ToDateTime(item.xValue), Convert.ToDouble(item.yValue));
                    }
                }
                rline.Title = "Rainfall";
                rCrtdayline.Title = "Crop Day";
                rline.Pointer.Visible = true;
                rline.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Circle;
                rline.Chart.Axes.Left.SetMinMax(0, Convert.ToDouble(dc + 5));
                var varMinDate = graphdata.Min(s => s.xValue);
                var varMaxDate = graphdata.Max(s => s.xValue);
                DateTime minDate = Convert.ToDateTime(varMinDate).AddDays(-1);
                DateTime maxDate = Convert.ToDateTime(varMaxDate).AddDays(1);
                rline.Chart.Axes.Bottom.SetMinMax(minDate, maxDate);
                rainfallChart.Axes.Bottom.Increment = Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.OneDay);
                rainfallChart.Axes.Bottom.Labels.DateTimeFormat = "dd/MM/yyyy";
                rainfallChart.Footer.Font.Size = 25;
                rainfallChart.Legend.Font.Size = 25;
                rainfallChart.Header.Font.Size = 25;
                rainfallChart.Axes.Bottom.Labels.Font.Size = 18;
                rainfallChart.Axes.Left.Labels.Font.Size = 15;
                rainfallChart.Legend.Transparent = true;
                rainfallChart.Header.Visible = true;
                rainfallChart.Axes.Bottom.Grid.Visible = false;
                rainfallChart.Header.Text = "Rain fall";
                rainfallChart.Legend.Visible = true;
                rainfallChart.Axes.Left.Grid.DrawEvery = 1;
                rainfallChart.Legend.Alignment = Steema.TeeChart.LegendAlignments.Bottom;
                rainfallChart.Panning.Allow = Steema.TeeChart.ScrollModes.None;
                rainfallChart.Panning.Allow = Steema.TeeChart.ScrollModes.None;
                rainfallChart.Zoom.Style = Steema.TeeChart.ZoomStyles.Classic;
                rainfallChart.Zoom.Allow = false;
                rainfallChart.Panning.Allow = ScrollModes.None;
                rainfallChart.SetPadding(0, 50, 0, 50);
                Android.Widget.LinearLayout.LayoutParams layoutParams = new Android.Widget.LinearLayout.LayoutParams(graphheight, graphwidth);
                layoutParams.TopMargin = 100;
                layoutParams.BottomMargin = 100;
                rainfallChart.ScrollBarStyle = ScrollbarStyles.InsideOverlay;
                rainfallChart.SetScrollContainer(false);
                srcgraph.AddView(rainfallChart, layoutParams);
            }
        }
        catch (Exception ex)
        {
            ErrorHandling.ErrorEntry(ex.Message.ToString(), "TodayGraphViewController - drawRainfallChart");
        }
    }

1 个答案:

答案 0 :(得分:1)

Zoom.Style 设置为 ZoomStyles.Classic 时,另一位用户最近报告了类似的问题(TM63016590)。我们对此有一个修复建议,可在https://www.steema.com/downloads/net_android的当前评估版中找到。如果它能解决你的问题,请告诉我们吗?