public override void DidDataPointSelect(SFChart chart, SFChartSelectionInfo info)
        {
            int selectedindex = info.SelectedDataPointIndex;

            if (selectedindex >= 0)
            {
                SFSeries series = info.SelectedSeries;
                if (series != null)
                {
                    SFChartDataPoint dataPoint = (chart.DataSource as ChartSelectionDataSource).GetDataPoint(chart, selectedindex, 0);
                    if (dataPoint == null)
                    {
                        (chart.Superview as DataPointSelection).SetLabelContent(null, null);
                    }
                    else
                    {
                        String x = dataPoint.XValue.ToString();
                        String y = dataPoint.YValue.ToString();
                        (chart.Superview as DataPointSelection).SetLabelContent(x, y);
                    }
                }
            }
            else
            {
                (chart.Superview as DataPointSelection).SetLabelContent(null, null);
            }
        }
Пример #2
0
        public SFChartDataPoint dataPointWithTimeInterval(double time)
        {
            int      count = (int)DataPoints.Count;
            NSNumber value;

            if (count > 320)
            {
                value = random.Next(0, 0);
            }
            else if (count > 280)
            {
                value = random.Next(-2, 2);
            }
            else if (count > 240)
            {
                value = random.Next(-3, 3);
            }
            else if (count > 200)
            {
                value = random.Next(-5, 5);
            }
            else if (count > 180)
            {
                value = random.Next(-6, 6);
            }
            else if (count > 120)
            {
                value = random.Next(-7, 7);
            }
            else if (count > 30)
            {
                value = random.Next(-9, 9);
            }
            else
            {
                value = random.Next(-3, 3);
            }

            date = date.AddSeconds(time);

            SFChartDataPoint datapoint = new SFChartDataPoint();

            datapoint.XValue = NSObject.FromObject(date);
            datapoint.YValue = value;
            return(datapoint);
        }