예제 #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            //Perform any additional setup after loading the view, typically from a nib.

            _chart       = new LineChartView();
            _chart.Frame = new CGRect(0, 10, 350, 200);
            _chart.ChartDescription.Enabled = false;
            _chart.DragEnabled      = true;
            _chart.PinchZoomEnabled = false;
            _chart.SetScaleEnabled(false);
            _chart.DrawGridBackgroundEnabled = false;
            _chart.Legend.Enabled            = false;
            _chart.RightAxis.Enabled         = false;
            _chart.HighlightPerDragEnabled   = false;

            ChartYAxis yAxis             = _chart.LeftAxis;
            var        leftAxisLimitLine = new ChartLimitLine(0);

            leftAxisLimitLine.LineColor = UIColor.FromRGB(147, 164, 172);
            leftAxisLimitLine.LineWidth = 2;
            yAxis.AddLimitLine(leftAxisLimitLine);

            yAxis.LabelPosition        = YAxisLabelPosition.OutsideChart;
            yAxis.DrawGridLinesEnabled = true;
            yAxis.AxisLineWidth        = 0;
            yAxis.GranularityEnabled   = true;

            ChartXAxis xAxis = _chart.XAxis;

            xAxis.LabelPosition        = XAxisLabelPosition.Bottom;
            xAxis.DrawGridLinesEnabled = false;
            xAxis.LabelTextColor       = UIColor.White;
            xAxis.GranularityEnabled   = true;
            Add(_chart);

            var label = new UILabel()
            {
                Frame = new CGRect(_chart.Bounds.Left + 30, _chart.Bounds.Bottom - 100, 40, 140)
            };

            label.Text      = "PREC\nHUM\nPRES";
            label.Lines     = 3;
            label.Font      = UIFont.FromName("WeatherIcons-Regular", 10);
            label.TextColor = UIColor.White;

            SetData();

            _chart.SetVisibleXRangeMaximum(8);

            View.Add(_chart);
        }
        public override void ViewDidLoad()
        {
            var axisTextSize = 14;

            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.

            _chart       = new CombinedChartView();
            _chart.Frame = new CGRect(0, 10, 300, 200);
            _chart.ChartDescription.Enabled = false;
            _chart.DragEnabled      = true;
            _chart.PinchZoomEnabled = false;
            _chart.SetScaleEnabled(false);
            _chart.DrawGridBackgroundEnabled = false;
            _chart.Legend.Enabled            = false;
            _chart.RightAxis.Enabled         = false;
            //_chart.Delegate = _delegate;
            _chart.HighlightPerDragEnabled = false;
            _chart.DrawOrder = new NSNumber[] { 0, 2 };

            ChartYAxis yAxis             = _chart.LeftAxis;
            var        leftAxisLimitLine = new ChartLimitLine(0);

            leftAxisLimitLine.LineColor = UIColor.FromRGB(147, 164, 172);
            leftAxisLimitLine.LineWidth = 2;
            yAxis.AddLimitLine(leftAxisLimitLine);

            //_yAxisValueFormater = new ForecastChartAxisUnitValueFormatter();
            //yAxis.LabelTextColor = Styles.Colors.DarkAqua;
            yAxis.LabelPosition        = YAxisLabelPosition.OutsideChart;
            yAxis.DrawGridLinesEnabled = true;
            yAxis.AxisLineWidth        = 0;
            yAxis.Granularity          = 1;
            yAxis.GranularityEnabled   = true;
            yAxis.LabelFont            = UIFont.SystemFontOfSize(12);
            //yAxis.ValueFormatter = _yAxisValueFormater;

            //_xAxisValueFormater = new ForecastWeatherChartXAxisValueFormatter();
            ChartXAxis xAxis = _chart.XAxis;

            //xAxis.LabelTextColor = Styles.Colors.DarkAqua;
            xAxis.LabelPosition        = XAxisLabelPosition.Bottom;
            xAxis.DrawGridLinesEnabled = false;
            xAxis.AxisLineWidth        = 0;
            xAxis.LabelFont            = UIFont.FromName("WeatherIcons-Regular", 10);
            xAxis.Granularity          = 1.0f;
            xAxis.GranularityEnabled   = true;
            //xAxis.ValueFormatter = _xAxisValueFormater;
            Add(_chart);

            var label = new UILabel()
            {
                Frame = new CGRect(_chart.Bounds.Left + 30, _chart.Bounds.Bottom - 100, 40, 140)
            };

            label.Text      = "PREC\nHUM\nPRES";
            label.Lines     = 3;
            label.Font      = UIFont.FromName("WeatherIcons-Regular", 10);
            label.TextColor = UIColor.White;
            View.Add(label);

            SetData();
            _chart.MoveViewToX(10.0);

            //_mChart = new BarChartView();

            //_mChart.MaxVisibleCount = 60;
            //_mChart.PinchZoomEnabled = false;
            //var description = _mChart.Description;
            //description = null;
            //_mChart.DrawGridBackgroundEnabled = false;
            //_mChart.SetExtraOffsetsWithLeft(5, 5, 5, 5);

            //ChartLegend legend = _mChart.Legend;
            //legend.Enabled = false;

            //ChartYAxis rightAxis = _mChart.RightAxis;
            //rightAxis.Enabled = false;

            //ChartYAxis leftAxis = _mChart.LeftAxis;
            //leftAxis.LabelTextColor = UIColor.White;
            //leftAxis.LabelFont = UIFont.SystemFontOfSize(axisTextSize);
            //leftAxis.LabelPosition = YAxisLabelPosition.OutsideChart;
            //leftAxis.DrawGridLinesEnabled = false;
            //leftAxis.SpaceMin = 20;
            //leftAxis.ValueFormatter = new MyCustomFormatter();
            //leftAxis.DrawGridLinesEnabled = true;
            //leftAxis.GridLineWidth = 1;
            //leftAxis.GridColor = UIColor.FromRGB(147, 164, 173);

            //ChartXAxis bottomAxis = _mChart.XAxis;
            //bottomAxis.LabelTextColor = UIColor.White;
            //bottomAxis.LabelFont = UIFont.SystemFontOfSize(axisTextSize);
            //bottomAxis.LabelPosition = XAxisLabelPosition.Bottom;
            //bottomAxis.DrawGridLinesEnabled = false;

            //_mChart.Data = GenerateBarData();

            //_mChart.Frame = new CoreGraphics.CGRect(15, 80, 300, 300);
            //View.Add(_mChart);
        }