Beispiel #1
0
        public override void WillShowTooltip(SFChart chart, SFChartTooltip tooltipView)
        {
            UIView customView = new UIView();

            customView.Frame = new CGRect(0, 0, 80, 40);

            UIImageView imageView = new UIImageView();

            imageView.Frame = new CGRect(0, 0, 40, 40);
            imageView.Image = UIImage.FromBundle("Images/grain.png");

            UILabel xLabel = new UILabel();

            xLabel.Frame     = new CGRect(47, 0, 35, 18);
            xLabel.TextColor = UIColor.Orange;
            xLabel.Font      = UIFont.FromName("Helvetica", 12f);
            xLabel.Text      = (tooltipView.DataPoint as ChartDataModel).XValue.ToString();

            UILabel yLabel = new UILabel();

            yLabel.Frame     = new CGRect(47, 20, 40, 18);
            yLabel.TextColor = UIColor.White;
            yLabel.Font      = UIFont.FromName("Helvetica", 12f);
            yLabel.Text      = tooltipView.Text + "M";

            customView.AddSubview(imageView);
            customView.AddSubview(xLabel);
            customView.AddSubview(yLabel);
            tooltipView.CustomView = customView;
        }
Beispiel #2
0
        public override void WillShowTooltip(SFChart chart, SFChartTooltip tooltipView)
        {
            var point = tooltipView.DataPoint as InputDataTable;
            var label = tooltipView.Series.Label;

            if (point != null)
            {
                var minutes = point.Time / 60;

                switch (label)
                {
                case "Temperature":
                    tooltipView.Text = NSString.FromData(NSData.FromString($"{point.Temperature:0.0}°C {minutes:0} min"), NSStringEncoding.ASCIIStringEncoding);
                    break;

                case "Pressure":
                    tooltipView.Text = NSString.FromData(NSData.FromString($"{point.Pressure:0.0}mB {minutes:0} min"), NSStringEncoding.ASCIIStringEncoding);
                    break;

                case "Humidity":
                    tooltipView.Text = NSString.FromData(NSData.FromString($"{point.Humidity:0}% {minutes:0} min"), NSStringEncoding.ASCIIStringEncoding);
                    break;

                case "Wind speed":
                    tooltipView.Text = NSString.FromData(NSData.FromString($"{point.WindSpeed:0.0}m/s {minutes:0} min"), NSStringEncoding.ASCIIStringEncoding);
                    break;

                default:
                    break;
                }
            }
            base.WillShowTooltip(chart, tooltipView);
        }
            public override void WillShowTooltip(SFChart chart, SFChartTooltip tooltipView)
            {
                UIView customView = new UIView();

                customView.Frame = new CGRect(0, 0, 95, 55);
                var height = customView.Frame.Height / 3;

                UILabel label = new UILabel();

                label.Frame         = new CGRect(0, 0, customView.Frame.Width, height);
                label.TextColor     = UIColor.White;
                label.Font          = UIFont.FromName("Helvetica", 12f);
                label.TextAlignment = UITextAlignment.Center;
                label.Text          = tooltipView.Series.Label;

                UILabel box = new UILabel();

                box.Frame           = new CGRect(customView.Frame.X, label.Frame.Height, customView.Frame.Width, 1);
                box.BackgroundColor = UIColor.White;

                UILabel xLabel = new UILabel();

                xLabel.Frame     = new CGRect(5, 35, 60, height);
                xLabel.TextColor = UIColor.LightGray;
                xLabel.Font      = UIFont.FromName("Helvetica", 12f);
                xLabel.Text      = "Height : ";

                UILabel xValue = new UILabel();

                xValue.Frame     = new CGRect(53, 35, 40, height);
                xValue.TextColor = UIColor.White;
                xValue.Font      = UIFont.FromName("Helvetica", 12f);
                xValue.Text      = (tooltipView.DataPoint as ChartDataModel).XValue.ToString();

                UILabel yLabel = new UILabel();

                yLabel.Frame     = new CGRect(5, 20, 60, height);
                yLabel.TextColor = UIColor.LightGray;
                yLabel.Font      = UIFont.FromName("Helvetica", 12f);
                yLabel.Text      = "Weight : ";

                UILabel yValue = new UILabel();

                yValue.Frame     = new CGRect(54, 20, 55, height);
                yValue.TextColor = UIColor.White;
                yValue.Font      = UIFont.FromName("Helvetica", 12f);
                yValue.Text      = (tooltipView.DataPoint as ChartDataModel).YValue + " lbs";

                customView.AddSubview(label);
                customView.AddSubview(box);
                customView.AddSubview(xLabel);
                customView.AddSubview(xValue);
                customView.AddSubview(yLabel);
                customView.AddSubview(yValue);
                tooltipView.CustomView = customView;
            }
        public override void WillShowTooltip(SFChart chart, SFChartTooltip tooltipView)
        {
            UIView customView = new UIView();

            customView.Frame = new CGRect(0, 0, 65, 45);

            UILabel label = new UILabel();

            label.Frame     = new CGRect(20, 0, 180, 18);
            label.TextColor = UIColor.White;
            label.Font      = UIFont.FromName("Helvetica", 12f);
            label.Text      = "Score";

            UILabel box = new UILabel();

            box.Frame           = new CGRect(customView.Frame.X, label.Frame.Height + 2, customView.Frame.Width, 1);
            box.BackgroundColor = UIColor.White;

            var data  = tooltipView.DataPoint as List <object>;
            int x     = 0;
            int index = (int)(data[0] as ChartDataModel).YValue / interval;

            x = interval * index;

            UILabel xLabel = new UILabel();

            xLabel.Frame     = new CGRect(5, 25, 80, 18);
            xLabel.TextColor = UIColor.LightGray;
            xLabel.Font      = UIFont.FromName("Helvetica", 12f);
            xLabel.Text      = x + "-" + (x + interval) + " : ";

            UILabel xValue = new UILabel();

            xValue.Frame     = index == 4 ? new CGRect(52, 25, 35, 18) : new CGRect(45, 25, 35, 18);
            xValue.TextColor = UIColor.White;
            xValue.Font      = UIFont.FromName("Helvetica", 12f);
            xValue.Text      = data.Count.ToString();

            customView.AddSubview(label);
            customView.AddSubview(box);
            customView.AddSubview(xLabel);
            customView.AddSubview(xValue);
            tooltipView.CustomView = customView;
        }
Beispiel #5
0
        public override void WillShowTooltip(SFChart chart, SFChartTooltip tooltipView)
        {
            UIView customView = new UIView();

            customView.Frame = new CGRect(0, 0, 140, 70);

            UILabel label = new UILabel();

            label.Frame     = new CGRect(45, 0, 180, 18);
            label.TextColor = UIColor.White;
            label.Font      = UIFont.FromName("Helvetica", 12f);
            label.Text      = (tooltipView.DataPoint as ChartDataModel).Label;

            UILabel box = new UILabel();

            box.Frame           = new CGRect(customView.Frame.X, label.Frame.Height, customView.Frame.Width, 1);
            box.BackgroundColor = UIColor.White;

            UILabel xLabel = new UILabel();

            xLabel.Frame     = new CGRect(5, 20, 80, 18);
            xLabel.TextColor = UIColor.LightGray;
            xLabel.Font      = UIFont.FromName("Helvetica", 12f);
            xLabel.Text      = "Literacy Rate : ";

            UILabel xValue = new UILabel();

            xValue.Frame     = new CGRect(87, 20, 35, 18);
            xValue.TextColor = UIColor.White;
            xValue.Font      = UIFont.FromName("Helvetica", 12f);
            xValue.Text      = (tooltipView.DataPoint as ChartDataModel).XValue + "%";

            UILabel yLabel = new UILabel();

            yLabel.Frame     = new CGRect(5, 35, 180, 18);
            yLabel.TextColor = UIColor.LightGray;
            yLabel.Font      = UIFont.FromName("Helvetica", 12f);
            yLabel.Text      = "GDP Growth Rate : ";

            UILabel yValue = new UILabel();

            yValue.Frame     = new CGRect(112, 35, 35, 18);
            yValue.TextColor = UIColor.White;
            yValue.Font      = UIFont.FromName("Helvetica", 12f);
            yValue.Text      = tooltipView.Text;

            UILabel sizeLabel = new UILabel();

            sizeLabel.Frame     = new CGRect(5, 50, 65, 18);
            sizeLabel.TextColor = UIColor.LightGray;
            sizeLabel.Font      = UIFont.FromName("Helvetica", 12f);
            sizeLabel.Text      = "Population : ";

            UILabel sizeValue = new UILabel();

            sizeValue.Frame     = new CGRect(73, 50, 90, 18);
            sizeValue.TextColor = UIColor.White;
            sizeValue.Font      = UIFont.FromName("Helvetica", 12f);
            sizeValue.Text      = (tooltipView.DataPoint as ChartDataModel).Size + " Billion";

            customView.AddSubview(label);
            customView.AddSubview(box);
            customView.AddSubview(xLabel);
            customView.AddSubview(xValue);
            customView.AddSubview(yLabel);
            customView.AddSubview(yValue);
            customView.AddSubview(sizeLabel);
            customView.AddSubview(sizeValue);
            tooltipView.CustomView = customView;
        }
 public override void WillShowTooltip(SFChart chart, SFChartTooltip tooltipView)
 {
     base.WillShowTooltip(chart, tooltipView);
     tooltipView.PointerLength = (nfloat)formsChart.PointerLength;
 }