Beispiel #1
0
        public override SFSeries GetSeries(SFChart chart, nint index)
        {
            SFOHLCSeries series = new SFOHLCSeries();

            series.LineWidth = 5;
            return(series);
        }
Beispiel #2
0
        public OHLC()
        {
            SFChart chart = new SFChart();

            chart.Title.Text                        = new NSString("Financial Analysis");
            chart.PrimaryAxis                       = new SFDateTimeAxis();
            chart.PrimaryAxis.Title.Text            = new NSString("Date");
            chart.PrimaryAxis.LabelRotationAngle    = -45;
            chart.PrimaryAxis.EdgeLabelsDrawingMode = SFChartAxisEdgeLabelsDrawingMode.Hide;
            chart.SecondaryAxis                     = new SFNumericalAxis();
            chart.SecondaryAxis.Title.Text          = new NSString("Price in Dollar");
            chart.SecondaryAxis.Minimum             = new NSNumber(0);
            chart.SecondaryAxis.Maximum             = new NSNumber(250);
            chart.SecondaryAxis.Interval            = new NSNumber(50);

            chart.Delegate = new ChartDollarDelegate();
            ChartViewModel dataModel = new ChartViewModel();

            SFOHLCSeries series = new SFOHLCSeries();

            series.ItemsSource        = dataModel.FinancialData;
            series.XBindingPath       = "XValue";
            series.High               = "High";
            series.Low                = "Low";
            series.Open               = "Open";
            series.Close              = "Close";
            series.EnableTooltip      = true;
            series.EnableAnimation    = true;
            series.ColorModel.Palette = SFChartColorPalette.Natural;
            chart.Series.Add(series);

            chart.AddChartBehavior(new SFChartZoomPanBehavior());
            this.AddSubview(chart);
        }
        public TechnicalIndicators()
        {
            indicatorTypePicker = new UIPickerView();

            indicatorTypeTextButton = new UIButton();
            doneButton             = new UIButton();
            indicator              = new SFSMAIndicator();
            indicator.SeriesName   = new NSString("Hi-Low");
            indicator.XBindingPath = "XValue";
            indicator.High         = "High";
            indicator.Low          = "Low";
            indicator.Open         = "Open";
            indicator.Close        = "Close";

            SFNumericalAxis axis = new SFNumericalAxis();

            axis.OpposedPosition    = true;
            axis.ShowMajorGridLines = false;
            indicator.YAxis         = axis;

            indicatorCollection = new NSMutableArray();
            indicatorCollection.Add(indicator);

            chart                     = new SFChart();
            chart.Title.Text          = new NSString("StockDetails");
            chart.Title.TextAlignment = UITextAlignment.Center;

            SFDateTimeAxis datetime = new SFDateTimeAxis();

            datetime.MaximumLabels         = 6;
            datetime.LabelsIntersectAction = SFChartAxisLabelsIntersectAction.Hide;
            chart.PrimaryAxis   = datetime;
            datetime.Title.Text = new NSString("Date");
            chart.SecondaryAxis = new SFNumericalAxis();

            SFChartTrackballBehavior behavior = new SFChartTrackballBehavior();

            chart.AddChartBehavior(behavior);
            chart.TechnicalIndicators.Add(indicator);

            ChartViewModel dataModel = new ChartViewModel();
            SFOHLCSeries   series    = new SFOHLCSeries();

            series.ItemsSource        = dataModel.TechnicalIndicatorData;
            series.XBindingPath       = "XValue";
            series.High               = "High";
            series.Low                = "Low";
            series.Open               = "Open";
            series.Close              = "Close";
            series.EnableTooltip      = true;
            series.LineWidth          = 1;
            series.SeriesName         = new NSString("Hi-Low");
            series.ColorModel.Palette = SFChartColorPalette.Natural;
            chart.Series.Add(series);

            this.AddSubview(chart);

            indicatorTypeTextButton.SetTitle("SMA indicator", UIControlState.Normal);
            indicatorTypeTextButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            indicatorTypeTextButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            indicatorTypeTextButton.TouchUpInside += delegate
            {
                indicatorTypePicker.Hidden = false;
                doneButton.Hidden          = false;
                this.BecomeFirstResponder();
            };
            indicatorTypeTextButton.BackgroundColor    = UIColor.Clear;
            indicatorTypeTextButton.Layer.BorderWidth  = 2.0f;
            indicatorTypeTextButton.Layer.BorderColor  = UIColor.FromRGB(240.0f / 255.0f, 240.0f / 255.0f, 240.0f / 255.0f).CGColor;
            indicatorTypeTextButton.Layer.CornerRadius = 8.0f;
            this.AddSubview(indicatorTypeTextButton);

            indicatorTypePicker.ShowSelectionIndicator = true;
            indicatorTypePicker.Hidden = true;

            indicatorTypePicker.Model = new StatusPickerViewModel(chart, indicatorTypeTextButton, indicator, indicatorCollection);

            indicatorTypePicker.BackgroundColor = UIColor.FromRGB(240f / 255.0f, 240f / 255.0f, 240f / 255.0f);
            indicatorTypePicker.SelectedRowInComponent(0);
            this.AddSubview(indicatorTypePicker);

            doneButton.SetTitle("Done" + "\t", UIControlState.Normal);
            doneButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Right;
            doneButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            doneButton.TouchUpInside += delegate
            {
                indicatorTypePicker.Hidden = true;
                doneButton.Hidden          = true;
                this.BecomeFirstResponder();
            };

            doneButton.BackgroundColor = UIColor.FromRGB(240f / 255.0f, 240f / 255.0f, 240f / 255.0f);
            doneButton.Hidden          = true;
            this.AddSubview(doneButton);
        }
Beispiel #4
0
		public override SFSeries GetSeries (SFChart chart, nint index)
		{
			SFOHLCSeries series			= new SFOHLCSeries ();
			series.LineWidth 			= 5;
			return series;
		}