public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.
            chart          = new FlexChart();
            chart.BindingX = "Name";
            chart.Series.Add(new ChartSeries()
            {
                SeriesName = "Sales", Binding = "Sales,Sales"
            });
            chart.Series.Add(new ChartSeries()
            {
                SeriesName = "Expenses", Binding = "Expenses,Expenses"
            });
            chart.Series.Add(new ChartSeries()
            {
                SeriesName = "Downloads", Binding = "Downloads,Downloads"
            });
            chart.ItemsSource = SalesData.GetSalesDataList();
            this.Add(chart);
            chart.Palette        = Palette.Cocoa;
            chart.Stacking       = ChartStackingType.Stacked;
            chart.LegendPosition = ChartPositionType.Bottom;

            MyTooltip t = new MyTooltip();

            t.Frame               = new CGRect(0, 0, 100, 50);
            t.BackgroundColor     = new UIColor(1.0f, 1.0f, 0.792f, 1.0f);
            chart.ToolTip         = t;
            chart.ToolTipLoading += (object sender, ChartTooltipLoadingEventArgs args) =>
            {
                ChartHitTestInfo e = args.HitTestInfo;
                if (e.Distance < 2 && e.PointIndex >= 0)
                {
                    double left = e.Point.X, top = e.Point.Y - t.Frame.Height, width = t.Frame.Width, height = t.Frame.Height;
                    double screenWidth = UIScreen.MainScreen.Bounds.Size.Width;
                    double margin      = 5;
                    if (left + width > screenWidth)
                    {
                        left = screenWidth - width - margin;
                    }
                    t.Frame = new CGRect(left, top, width, height);
                    t.UpdateContent(e);
                    t.IsOpen = true;
                }
                else
                {
                    t.IsOpen = false;
                }
            };
        }
Ejemplo n.º 2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.
            chart          = new FlexChart();
            chart.BindingX = "Name";
            chart.Series.Add(new ChartSeries()
            {
                SeriesName = "Sales", Binding = "Sales,Sales"
            });
            chart.Series.Add(new ChartSeries()
            {
                SeriesName = "Expenses", Binding = "Expenses,Expenses"
            });
            chart.Series.Add(new ChartSeries()
            {
                SeriesName = "Downloads", Binding = "Downloads,Downloads"
            });
            chart.ItemsSource = SalesData.GetSalesDataList();
            this.Add(chart);
            chart.Palette        = Palette.Cocoa;
            chart.Stacking       = ChartStackingType.Stacked;
            chart.LegendPosition = ChartPositionType.Bottom;

            MyTooltip t = new MyTooltip();

            t.Frame           = new CGRect(0, 0, 100, 50);
            t.BackgroundColor = new UIColor(1.0f, 1.0f, 0.792f, 1.0f);

            chart.ToolTipLoading += (object sender, ChartTooltipLoadingEventArgs args) =>
            {
                ChartHitTestInfo e = args.HitTestInfo;
                if (e.Distance < 2 && e.PointIndex >= 0)
                {
                    t.UpdateContent(e);
                }
                args.view = t;
            };
        }