public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.View.BackgroundColor = UIColor.DarkGray;
            // Perform any additional setup after loading the view, typically from a nib.
            _surfaceTop = new SCIChartSurface();
            _surfaceTop.TranslatesAutoresizingMaskIntoConstraints = false;

            _surfaceBottom = new SCIChartSurface();
            _surfaceBottom.TranslatesAutoresizingMaskIntoConstraints = false;

            _szem = new SCIMultiSurfaceModifier(GetClassForType(typeof(SCIZoomExtentsModifier)));

            this.View.AddSubview(_surfaceTop);
            this.View.AddSubview(_surfaceBottom);

            var viewsDictionary = NSDictionary.FromObjectsAndKeys(new NSObject[] { _surfaceTop, _surfaceBottom }, new NSObject[] { new NSString("_surfaceTop"), new NSString("_surfaceBottom") });

            this.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-[_surfaceTop]-|", 0, new NSDictionary(), viewsDictionary));
            this.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-[_surfaceTop]-(==1)-[_surfaceBottom(==_surfaceTop)]-|", 0, new NSDictionary(), viewsDictionary));
            this.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("|-[_surfaceBottom(==_surfaceTop)]-|", 0, new NSDictionary(), viewsDictionary));

            AddAxes(_surfaceTop);
            AddAxes(_surfaceBottom);

            _surfaceTop.Annotations = _annotationCollection;

            CreateDataSeries();
            CreateRenderableSeries();
            AddModifiers();
        }
示例#2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.
            _surface = new SCIChartSurface();
            _surface.TranslatesAutoresizingMaskIntoConstraints = true;
            _surface.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;
            _surface.Frame            = this.View.Bounds;

            this.View.AddSubview(_surface);

            _surface.XAxes.Add(new SCINumericAxis()
            {
                GrowBy = new SCIDoubleRange(0.1, 0.1), Style = new SCIAxisStyle {
                    GridBandBrush = new SCISolidBrushStyle(UIColor.Clear)
                }
            });
            _surface.YAxes.Add(new SCINumericAxis()
            {
                GrowBy = new SCIDoubleRange(0.1, 0.1), Style = new SCIAxisStyle {
                    GridBandBrush = new SCISolidBrushStyle(UIColor.Clear)
                }
            });

            CreateDataSeries();
            CreateRenderableSeries();
            AddModifiers();

            _surface.Annotations = _annotationCollection;
        }
        private void InitChart(SCIChartSurface surface, BasePaneModel model, bool isMainPain)
        {
            _axisAreaSizeSync.AttachSurface(surface);

            var xAxis = new SCICategoryDateTimeAxis {
                IsVisible = isMainPain, GrowBy = new SCIDoubleRange(0, 0.05)
            };

            _axisRangeSync.AttachAxis(xAxis);

            using (surface.SuspendUpdates())
            {
                surface.XAxes.Add(xAxis);
                surface.YAxes.Add(model.YAxis);
                surface.RenderableSeries = model.RenderableSeries;
                surface.Annotations      = model.Annotations;

                surface.ChartModifiers = new SCIChartModifierCollection
                {
                    new SCIXAxisDragModifier {
                        DragMode = SCIAxisDragMode.Pan, ClipModeX = SCIClipMode.StretchAtExtents
                    },
                    new SCIPinchZoomModifier {
                        Direction = SCIDirection2D.XDirection
                    },
                    new SCIZoomPanModifier(),
                    new SCIZoomExtentsModifier(),
                    new SCILegendModifier {
                        ShowCheckBoxes = false
                    }
                };
            }
        }
        protected override void InitExampleInternal()
        {
            Surface = new SCIChartSurface(_exampleViewLayout.SciChartSurfaceView);
            StyleHelper.SetSurfaceDefaultStyle(Surface);

            var axisStyle = StyleHelper.GetDefaultAxisStyle();
            var xAxis     = new SCINumericAxis {
                IsXAxis = true, Style = axisStyle
            };
            var yAxis = new SCINumericAxis {
                Style = axisStyle
            };

            var renderSeries = new SCIHeatMapRenderableSeries
            {
                //DataSeries = _dataSeries,
                Style = { }
            };

            Surface.XAxes.AddItem(xAxis);
            Surface.YAxes.AddItem(yAxis);
            Surface.AttachRenderableSeries(renderSeries);

            Surface.ChartModifier = new SCIModifierGroup(new ISCIChartModifierProtocol[]
            {
                new SCIZoomPanModifier(),
                new SCIPinchZoomModifier(),
                new SCIZoomExtentsModifier()
            });

            Surface.InvalidateElement();

            _timer.Elapsed += OnTick;
            _timer.Start();
        }
示例#5
0
        public static void SetSurfaceDefaultStyle(SCIChartSurface surface)
        {
            var seriesBackgroundBrush = new SCIBrushSolid(0xFF1e1c1c);

            surface.Style.BackgroundBrush       = seriesBackgroundBrush;
            surface.Style.SeriesBackgroundBrush = seriesBackgroundBrush;
        }
        protected override void InitExampleInternal()
        {
            Surface = new SCIChartSurface(_exampleViewLayout.SciChartSurfaceView);
            StyleHelper.SetSurfaceDefaultStyle(Surface);

            var xAxis = new SCINumericAxis {
                IsXAxis = true, AxisAlignment = SCIAxisAlignmentMode.Left
            };
            var yAxis = new SCINumericAxis {
                AxisAlignment = SCIAxisAlignmentMode.Bottom, FlipCoordinates = true
            };

            var yValues1 = new[] { 0.0, 0.1, 0.2, 0.4, 0.8, 1.1, 1.5, 2.4, 4.6, 8.1, 11.7, 14.4, 16.0, 13.7, 10.1, 6.4, 3.5, 2.5, 5.4, 6.4, 7.1, 8.0, 9.0 };
            var yValues2 = new[] { 2.0, 10.1, 10.2, 10.4, 10.8, 1.1, 11.5, 3.4, 4.6, 0.1, 1.7, 14.4, 16.0, 13.7, 10.1, 6.4, 3.5, 2.5, 1.4, 0.4, 10.1, 0.0, 0.0 };
            var yValues3 = new[] { 20.0, 4.1, 4.2, 10.4, 10.8, 1.1, 11.5, 3.4, 4.6, 5.1, 5.7, 14.4, 16.0, 13.7, 10.1, 6.4, 3.5, 2.5, 1.4, 10.4, 8.1, 10.0, 15.0 };

            var ds1 = new XyDataSeries <double, double> {
                SeriesName = "data 1"
            };
            var ds2 = new XyDataSeries <double, double> {
                SeriesName = "data 2"
            };
            var ds3 = new XyDataSeries <double, double> {
                SeriesName = "data 3"
            };

            for (var i = 0; i < yValues1.Length; i++)
            {
                ds1.Append(i, yValues1[i]);
                ds2.Append(i, yValues2[i]);
                ds3.Append(i, yValues3[i]);
            }

            //TODO finish after porting StackedSeries to Xamarin from iOS
            var series1 = GetRenderableSeries(ds1, UIColor.FromRGB(0x56, 0x78, 0x93), UIColor.FromRGB(0x56, 0x78, 0x93), UIColor.FromRGB(0x3D, 0x55, 0x68));
            var series2 = GetRenderableSeries(ds2, UIColor.FromRGB(0xAC, 0xBC, 0xCA), UIColor.FromRGB(0xAC, 0xBC, 0xCA), UIColor.FromRGB(0x43, 0x9A, 0xAF));
            var series3 = GetRenderableSeries(ds3, UIColor.FromRGB(0xDB, 0xE0, 0xE1), UIColor.FromRGB(0xDB, 0xE0, 0xE1), UIColor.FromRGB(0xB6, 0xC1, 0xC3));

            var columnsCollection = new SCIStackedVerticalColumnGroupSeries();

            columnsCollection.AddSeries(series1);
            columnsCollection.AddSeries(series2);
            columnsCollection.AddSeries(series3);

            Surface.AttachAxis(xAxis, true);
            Surface.AttachAxis(yAxis, false);
            Surface.AttachRenderableSeries(columnsCollection);

            Surface.ChartModifier = new SCIModifierGroup(new ISCIChartModifierProtocol[]
            {
                new SCICursorModifier(),
                new SCIZoomExtentsModifier()
            });

            Surface.InvalidateElement();
        }
示例#7
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // init sciChart
            SCIChartSurface.SetRuntimeLicenseKey("");

            global::Xamarin.Forms.Forms.Init();
            LoadApplication(new App());

            return(base.FinishedLaunching(app, options));
        }
        protected override void InitExampleInternal()
        {
            Surface = new SCIChartSurface(_exampleViewLayout.SciChartSurfaceView);
            StyleHelper.SetSurfaceDefaultStyle(Surface);

            var dataSeries      = new XyzDataSeries <DateTime, double, double>();
            var tradeDataSource = DataManager.Instance.GetTradeticks().ToArray();

            dataSeries.Append(
                tradeDataSource.Select(x => x.TradeDate).ToArray(),
                tradeDataSource.Select(x => x.TradePrice).ToArray(),
                tradeDataSource.Select(x => x.TradeSize).ToArray());

            var axisStyle = StyleHelper.GetDefaultAxisStyle();
            var xAxis     = new SCIDateTimeAxis {
                IsXAxis = true, GrowBy = new SCIDoubleRange(0, 0.1), Style = axisStyle
            };
            var yAxis = new SCINumericAxis {
                GrowBy = new SCIDoubleRange(0, 0.1), Style = axisStyle
            };

            var lineSeries = new SCIFastLineRenderableSeries
            {
                DataSeries = dataSeries,
                Style      = { LinePen = new SCIPenSolid(0xFFFF3333, 1f) }
            };

            //var stops = new[] { 0, 0.95f, 1 };
            //var colors = new int[] { Color.Transparent, Resources.GetColor(Resource.Color.color_primary), Color.Transparent };
            //var gradientFill = new RadialGradientBrushStyle(0.5f, 0.5f, 0.5f, 0.5f, colors, stops, TileMode.Clamp);
            var bubbleSeries = new SCIBubbleRenderableSeries
            {
                DataSeries = dataSeries,
                //ZScale = 3,
                //AutoZRange = false,
                Style =
                {
                    BubbleBrush = new SCIBrushLinearGradient(0x7f090048, 0x30090048, SCILinearGradientDirection.Vertical)
                }
            };

            Surface.AttachAxis(xAxis, true);
            Surface.AttachAxis(yAxis, false);
            Surface.AttachRenderableSeries(lineSeries);
            Surface.AttachRenderableSeries(bubbleSeries);

            Surface.ChartModifier = new SCIModifierGroup(new ISCIChartModifierProtocol[]
            {
                new SCIZoomPanModifier(),
                new SCIPinchZoomModifier(),
                new SCIZoomExtentsModifier()
            });

            Surface.InvalidateElement();
        }
示例#9
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.
            _surface = new SCIChartSurface();
            _surface.TranslatesAutoresizingMaskIntoConstraints = true;
            _surface.Frame = this.View.Bounds;

            this.View.AddSubview(_surface);

            _surface.XAxes.Add(new SCINumericAxis());
            _surface.YAxes.Add(new SCINumericAxis());
        }
        protected override void InitExampleInternal()
        {
            Surface = new SCIChartSurface(_exampleViewLayout.SciChartSurfaceView);
            StyleHelper.SetSurfaceDefaultStyle(Surface);

            var ds1Points = DataManager.Instance.GetDampedSinewave(1.0, 0.05, 50, 5);

            var dataSeries = new XyDataSeries <double, double>();

            dataSeries.Append(ds1Points.XData, ds1Points.YData);

            var axisStyle = StyleHelper.GetDefaultAxisStyle();
            var xAxis     = new SCINumericAxis {
                IsXAxis = true, GrowBy = new SCIDoubleRange(0.1, 0.1), Style = axisStyle
            };
            var yAxis = new SCINumericAxis {
                GrowBy = new SCIDoubleRange(0.1, 0.1), Style = axisStyle
            };

            var renderSeries = new SCIFastImpulseRenderableSeries
            {
                DataSeries = dataSeries,
                Style      =
                {
                    LinePen     = new SCIPenSolid(UIColor.FromRGB(0x00,   0x66,  0xFF), 0.7f),
                    PointMarker = new SCIEllipsePointMarker
                    {
                        FillBrush = new SCIBrushSolid(UIColor.FromRGB(0x00, 0x66, 0xFF)),
                        BorderPen = new SCIPenSolid(UIColor.FromRGB(0x00,   0x66,  0xFF),   2f),
                        Width     =                                     10,
                        Height    = 10
                    }
                }
            };

            Surface.AttachAxis(xAxis, true);
            Surface.AttachAxis(yAxis, false);
            Surface.AttachRenderableSeries(renderSeries);

            Surface.ChartModifier = new SCIModifierGroup(new ISCIChartModifierProtocol[]
            {
                new SCIZoomPanModifier(),
                new SCIPinchZoomModifier(),
                new SCIZoomExtentsModifier()
            });

            Surface.InvalidateElement();
        }
        protected override void InitExampleInternal()
        {
            Surface = new SCIChartSurface(_exampleViewLayout.SciChartSurfaceView);
            StyleHelper.SetSurfaceDefaultStyle(Surface);

            var data0 = DataManager.Instance.GetDampedSinewave(1.0, 0.01, 1000);
            var data1 = DataManager.Instance.GetDampedSinewave(1.0, 0.005, 1000, 12);

            var dataSeries = new XyyDataSeries <double, double>();

            dataSeries.Append(data0.XData, data0.YData, data1.YData);

            var axisStyle = StyleHelper.GetDefaultAxisStyle();
            var xAxis     = new SCINumericAxis {
                IsXAxis = true, VisibleRange = new SCIDoubleRange(1.1, 2.7), Style = axisStyle
            };
            var yAxis = new SCINumericAxis {
                GrowBy = new SCIDoubleRange(0.1, 0.1), Style = axisStyle
            };

            var renderSeries = new SCIBandRenderableSeries
            {
                DataSeries = dataSeries,
                Style      = new SCIBandSeriesStyle
                {
                    Pen1   = new SCIPenSolid(0xFFFF1919, 0.7f),
                    Pen2   = new SCIPenSolid(0xFF279B27, 0.7f),
                    Brush1 = new SCIBrushSolid(0x33279B27),
                    Brush2 = new SCIBrushSolid(0x33FF1919)
                }
            };

            Surface.AttachAxis(xAxis, true);
            Surface.AttachAxis(yAxis, false);
            Surface.AttachRenderableSeries(renderSeries);

            Surface.ChartModifier = new SCIModifierGroup(new ISCIChartModifierProtocol[]
            {
                new SCIZoomPanModifier(),
                new SCIPinchZoomModifier(),
                new SCIZoomExtentsModifier()
            });

            Surface.InvalidateElement();
        }
        protected override void InitExampleInternal()
        {
            Surface = new SCIChartSurface(_exampleViewLayout.SciChartSurfaceView);
            StyleHelper.SetSurfaceDefaultStyle(Surface);

            var priceData = DataManager.Instance.GetPriceDataIndu();

            var dataSeries = new XyDataSeries <DateTime, double>();

            dataSeries.DataDistributionCalculator = new SCIUserDefinedDistributionCalculator();
            dataSeries.Append(priceData.TimeData, priceData.CloseData);

            var axisStyle = StyleHelper.GetDefaultAxisStyle();
            var xAxis     = new SCIDateTimeAxis {
                IsXAxis = true, GrowBy = new SCIDoubleRange(0.1, 0.1), Style = axisStyle, AxisId = "xAxis"
            };
            var yAxis = new SCINumericAxis {
                GrowBy = new SCIDoubleRange(0.1, 0.1), Style = axisStyle, AxisId = "yAxis"
            };

            var renderSeries = new SCIFastMountainRenderableSeries
            {
                DataSeries = dataSeries,
                XAxisId    = xAxis.AxisId,
                YAxisId    = yAxis.AxisId,
                Style      =
                {
                    AreaBrush = new SCIBrushLinearGradient(0xAAFF8D42, 0x88090E11, SCILinearGradientDirection.Vertical),
                    BorderPen = new SCIPenSolid(0xaaffc9a8, 0.7f)
                }
            };

            Surface.AttachAxis(xAxis, true);
            Surface.AttachAxis(yAxis, false);
            Surface.AttachRenderableSeries(renderSeries);

            Surface.ChartModifier = new SCIModifierGroup(new ISCIChartModifierProtocol[]
            {
                new SCIZoomPanModifier(),
                new SCIPinchZoomModifier(),
                new SCIZoomExtentsModifier()
            });

            Surface.InvalidateElement();
        }
示例#13
0
        protected override void InitExampleInternal()
        {
            Surface = new SCIChartSurface(_exampleViewLayout.SciChartSurfaceView);
            StyleHelper.SetSurfaceDefaultStyle(Surface);

            var data = DataManager.Instance.GetPriceDataIndu();

            var dataSeries = new OhlcDataSeries <DateTime, double>(TypeOfSeries.XCategory);

            dataSeries.Append(data.TimeData, data.OpenData, data.HighData, data.LowData, data.CloseData);

            var axisStyle = StyleHelper.GetDefaultAxisStyle();
            var xAxis     = new SCICategoryDateTimeAxis {
                IsXAxis = true, Style = axisStyle
            };
            var yAxis = new SCINumericAxis {
                GrowBy = new SCIDoubleRange(0.1, 0.1), Style = axisStyle
            };

            var renderSeries = new SCIFastCandlestickRenderableSeries
            {
                DataSeries = dataSeries,
                Style      =
                {
                    StrokeUpStyle      = new SCIPenSolid(UIColor.Green,    1f),
                    StrokeDownStyle    = new SCIPenSolid(UIColor.Red,      1f),
                    FillUpBrushStyle   = new SCIBrushSolid(UIColor.Green),
                    FillDownBrushStyle = new SCIBrushSolid(UIColor.Red)
                }
            };

            Surface.AttachAxis(xAxis, true);
            Surface.AttachAxis(yAxis, false);
            Surface.AttachRenderableSeries(renderSeries);

            Surface.ChartModifier = new SCIModifierGroup(new ISCIChartModifierProtocol[]
            {
                new SCIZoomPanModifier(),
                new SCIPinchZoomModifier(),
                new SCIZoomExtentsModifier()
            });

            Surface.InvalidateElement();
        }
示例#14
0
        protected override void InitExampleInternal()
        {
            Surface = new SCIChartSurface(_exampleViewLayout.SciChartSurfaceView);
            StyleHelper.SetSurfaceDefaultStyle(Surface);

            _exampleViewLayout.Start.TouchUpInside += (sender, args) => Start();
            _exampleViewLayout.Pause.TouchUpInside += (sender, args) => Pause();
            _exampleViewLayout.Reset.TouchUpInside += (sender, args) => Reset();

            var xAxis = new SCINumericAxis {
                IsXAxis = true, VisibleRange = _xVisibleRange, AutoRange = SCIAutoRangeMode.Never
            };
            var yAxis = new SCINumericAxis {
                GrowBy = new SCIDoubleRange(0.1, 0.1), AutoRange = SCIAutoRangeMode.Always
            };

            var rs1 = new SCIFastLineRenderableSeries
            {
                DataSeries = _ds1,
                Style      = { LinePen = new SCIPenSolid(UIColor.FromRGB(0x40, 0x83, 0xB7), 2f) }
            };
            var rs2 = new SCIFastLineRenderableSeries
            {
                DataSeries = _ds2,
                Style      = { LinePen = new SCIPenSolid(UIColor.FromRGB(0xFF, 0xA5, 0x00), 2f) }
            };
            var rs3 = new SCIFastLineRenderableSeries
            {
                DataSeries = _ds3,
                Style      = { LinePen = new SCIPenSolid(UIColor.FromRGB(0xE1, 0x32, 0x19), 2f) }
            };

            Surface.AttachAxis(xAxis, true);
            Surface.AttachAxis(yAxis, false);
            Surface.AttachRenderableSeries(rs1);
            Surface.AttachRenderableSeries(rs2);
            Surface.AttachRenderableSeries(rs3);

            Surface.InvalidateElement();

            Start();
        }
        private void AddAxes(SCIChartSurface surface)
        {
            surface.XAxes.Add(new SCINumericAxis()
            {
                GrowBy = new SCIDoubleRange(0.1, 0.1)
            });

            var yAxis = new SCINumericAxis();

            yAxis.GrowBy = new SCIDoubleRange(min: 0.1, max: 0.1);
            yAxis.AxisId = "firstYAxis";
            surface.YAxes.Add(yAxis);

            var yLeftAxis = new SCINumericAxis();

            yLeftAxis.AxisId        = "secondaryYAxis";
            yLeftAxis.AxisAlignment = SCIAxisAlignment.Left;
            yLeftAxis.VisibleRange  = new SCIDoubleRange(min: -2, max: 2);
            yLeftAxis.AutoRange     = SCIAutoRange.Never;
            surface.YAxes.Add(yLeftAxis);
        }
示例#16
0
        protected override void InitExampleInternal()
        {
            Surface = new SCIChartSurface(_exampleViewLayout.SciChartSurfaceView);
            StyleHelper.SetSurfaceDefaultStyle(Surface);

            var fourierSeries = DataManager.Instance.GetFourierSeries(1.0, 0.1);

            var dataSeries = new XyDataSeries <double, double>();

            dataSeries.Append(fourierSeries.XData, fourierSeries.YData);

            var axisStyle = StyleHelper.GetDefaultAxisStyle();
            var xAxis     = new SCINumericAxis {
                IsXAxis = true, GrowBy = new SCIDoubleRange(0.1, 0.1), Style = axisStyle
            };
            var yAxis = new SCINumericAxis {
                GrowBy = new SCIDoubleRange(0.1, 0.1), Style = axisStyle
            };

            var renderSeries = new SCIFastLineRenderableSeries
            {
                DataSeries = dataSeries,
                Style      = { LinePen = new SCIPenSolid(0xFF99EE99, 0.7f) }
            };

            Surface.AttachAxis(xAxis, true);
            Surface.AttachAxis(yAxis, false);
            Surface.AttachRenderableSeries(renderSeries);

            Surface.ChartModifier = new SCIModifierGroup(new ISCIChartModifierProtocol[]
            {
                new SCIZoomPanModifier(),
                new SCIPinchZoomModifier(),
                new SCIZoomExtentsModifier()
            });

            Surface.InvalidateElement();
        }
示例#17
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.
            _surface = new SCIChartSurface();
            _surface.TranslatesAutoresizingMaskIntoConstraints = true;
            _surface.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;
            _surface.Frame            = this.View.Bounds;

            this.View.AddSubview(_surface);

            var yAxis = new SCINumericAxis();

            yAxis.GrowBy = new SCIDoubleRange(min: 0.1, max: 0.1);
            yAxis.AxisId = "firstYAxis";
            _surface.YAxes.Add(yAxis);


            var yLeftAxis = new SCINumericAxis();

            yLeftAxis.AxisId        = "secondaryYAxis";
            yLeftAxis.AxisAlignment = SCIAxisAlignment.Left;
            yLeftAxis.VisibleRange  = new SCIDoubleRange(min: -2, max: 2);
            yLeftAxis.AutoRange     = SCIAutoRange.Never;
            _surface.YAxes.Add(yLeftAxis);

            _surface.XAxes.Add(new SCINumericAxis()
            {
                GrowBy = new SCIDoubleRange(0.1, 0.1)
            });

            _surface.Annotations = _annotationCollection;

            CreateDataSeries();
            CreateRenderableSeries();
            AddModifiers();
        }
        protected override void InitExampleInternal()
        {
            Surface = new SCIChartSurface(_exampleViewLayout.SciChartSurfaceView);
            StyleHelper.SetSurfaceDefaultStyle(Surface);

            var axisStyle = StyleHelper.GetDefaultAxisStyle();
            var xAxis     = new SCINumericAxis
            {
                IsXAxis   = true,
                AutoRange = SCIAutoRangeMode.Always,
                Style     = axisStyle
            };
            var leftAxis = new SCINumericAxis
            {
                AxisAlignment = SCIAxisAlignmentMode.Left,
                AxisId        = SCIAxisAlignmentMode.Left.ToString(),
                Style         = axisStyle
            };
            var rightAxis = new SCINumericAxis
            {
                AxisAlignment = SCIAxisAlignmentMode.Right,
                AxisId        = SCIAxisAlignmentMode.Right.ToString(),
                Style         = axisStyle
            };

            Surface.AttachAxis(xAxis, true);
            Surface.AttachAxis(leftAxis, false);
            Surface.AttachAxis(rightAxis, false);

            var initialColor = UIColor.Blue;

            for (var i = 0; i < SeriesCount; i++)
            {
                var alignment  = i % 2 == 0 ? SCIAxisAlignmentMode.Left : SCIAxisAlignmentMode.Right;
                var dataSeries = GenerateDataSeries(alignment, i);

                var rs = new SCIFastLineRenderableSeries
                {
                    DataSeries = dataSeries,
                    YAxisId    = alignment.ToString(),
                    Style      = { LinePen = new SCIPenSolid(initialColor, 2f) }
                };

                // Colors are incremented for visual purposes only
                var newR = initialColor.R() == 255 ? 255 : initialColor.R() + 5;
                var newB = initialColor.B() == 0 ? 0 : initialColor.B() - 2;
                initialColor = UIColor.FromRGB((byte)newR, initialColor.G(), (byte)newB);

                Surface.AttachRenderableSeries(rs);
            }

            //var selectedStrokeStyle = new PenStyle.Builder(Activity).WithColor(Color.White).WithThickness(4f).Build();
            //var selectedPointMarker = new EllipsePointMarker
            //{
            //    Width = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 10, Context.Resources.DisplayMetrics),
            //    Height = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 10, Context.Resources.DisplayMetrics),
            //    FillStyle = new SolidBrushStyle(Color.Argb(0xFF, 0xFF, 0x00, 0xDC)),
            //    StrokeStyle = new PenStyle.Builder(Activity).WithColor(Color.White).WithThickness(1f).Build()
            //};

            Surface.ChartModifier = new SCIModifierGroup(new ISCIChartModifierProtocol[]
            {
                //new SeriesSelectionModifier {SelectedSeriesStyle = new SelectedSeriesStyle(selectedStrokeStyle, selectedPointMarker)}
            });

            Surface.InvalidateElement();
        }
        protected override void InitExampleInternal()
        {
            Surface = new SCIChartSurface(_exampleViewLayout.SciChartSurfaceView);
            StyleHelper.SetSurfaceDefaultStyle(Surface);

            var data0 = DataManager.Instance.GetRandomDoubleSeries(10);

            var dataSeries = new XyDataSeries <double, double>();

            dataSeries.Append(data0.XData, data0.YData);

            var axisStyle = StyleHelper.GetDefaultAxisStyle();
            var xAxis     = new SCINumericAxis {
                GrowBy = new SCIDoubleRange(0.1, 0.1), Style = axisStyle
            };
            var yAxis = new SCINumericAxis {
                GrowBy = new SCIDoubleRange(0.1, 0.1), Style = axisStyle
            };

            var verticalRenderableSeries = new SCIFastFixedErrorBarsRenderableSeries
            {
                DataSeries = dataSeries,
                ErrorLow   = 0.1,
                ErrorHigh  = 0.3,
                ErrorType  = SCIErrorBarType.SCIErrorBarTypeRelative,
                Style      = new SCIErrorBarsSeriesStyle
                {
                    LinePen = new SCIPenSolid(new UIColor(70.0f / 255.0f, 130.0f / 255.0f, 180.0f / 255.0f, 1.0f), 0.7f)
                }
            };

            var horizontalRenderableSeries = new SCIFastFixedErrorBarsRenderableSeries
            {
                DataSeries          = dataSeries,
                ErrorDirection      = SCIErrorBarDirection.SCIErrorBarDirectionHorizontal,
                ErrorDataPointWidth = 0.5,
                Style = new SCIErrorBarsSeriesStyle
                {
                    LinePen = new SCIPenSolid(UIColor.Red, 0.7f)
                }
            };

            var renderSeries = new SCIFastLineRenderableSeries
            {
                DataSeries = dataSeries,
                Style      =
                {
                    LinePen          = new SCIPenSolid(new UIColor(176.0f / 255.0f,  196.0f / 255.0f, 222.0f / 255.0f, 1.0f), 0.7f),
                    DrawPointMarkers = true,
                    PointMarker      = new SCIEllipsePointMarker {
                        DrawBorder = true,
                        Width      =                                           15,
                        Height     =                                           15,
                        BorderPen  = new SCIPenSolid(new UIColor(176.0f / 255.0f,  196.0f / 255.0f, 222.0f / 255.0f, 1.0f), 1.0f),
                        FillBrush  = new SCIBrushSolid(new UIColor(70.0f / 255.0f, 130.0f / 255.0f, 180.0f / 255.0f, 1.0f))
                    }
                }
            };

            Surface.AttachAxis(xAxis, true);
            Surface.AttachAxis(yAxis, false);
            Surface.AttachRenderableSeries(verticalRenderableSeries);
            Surface.AttachRenderableSeries(horizontalRenderableSeries);
            Surface.AttachRenderableSeries(renderSeries);

            Surface.ChartModifier = new SCIModifierGroup(new ISCIChartModifierProtocol[]
            {
                new SCIZoomPanModifier(),
                new SCIPinchZoomModifier(),
                new SCIZoomExtentsModifier()
            });

            Surface.InvalidateElement();
        }
        protected override void InitExampleInternal()
        {
            Surface = new SCIChartSurface(_exampleViewLayout.SciChartSurfaceView);
            StyleHelper.SetSurfaceDefaultStyle(Surface);

            var axisStyle = StyleHelper.GetDefaultAxisStyle();
            var xAxis     = new SCINumericAxis {
                IsXAxis = true, GrowBy = new SCIDoubleRange(0.1, 0.1), AutoRange = SCIAutoRangeMode.Always, Style = axisStyle
            };
            var yAxis = new SCINumericAxis {
                GrowBy = new SCIDoubleRange(0.1, 0.1), Style = axisStyle
            };

            var ds1 = new XyDataSeries <double, double> {
                SeriesName = "Lissajous Curve", AcceptUnsortedData = true
            };
            var ds2 = new XyDataSeries <double, double> {
                SeriesName = "Sinewave", AcceptUnsortedData = true
            };

            var ds1Points = DataManager.Instance.GetLissajousCurve(0.8, 0.2, 0.43, 500);
            var ds2Points = DataManager.Instance.GetSinewave(1.5, 1.0, 500);

            var scaledXValues = GetScaledValues(ds1Points.XData);

            ds1.Append(scaledXValues, ds1Points.YData);
            ds2.Append(ds2Points.XData, ds2Points.YData);

            Surface.AttachAxis(xAxis, true);
            Surface.AttachAxis(yAxis, false);

            Surface.AttachRenderableSeries(new SCIFastLineRenderableSeries
            {
                DataSeries = ds1,
                Style      =
                {
                    LinePen     = new SCIPenSolid(SteelBlueColor, 2f),
                    PointMarker = new SCIEllipsePointMarker
                    {
                        Width     =                              5,
                        Height    =                              5,
                        BorderPen = new SCIPenSolid(SteelBlueColor, 2f),
                        FillBrush = new SCIBrushSolid(SteelBlueColor)
                    }
                }
            });
            Surface.AttachRenderableSeries(new SCIFastLineRenderableSeries
            {
                DataSeries = ds2,
                Style      =
                {
                    LinePen     = new SCIPenSolid(IndianRedColor, 2f),
                    PointMarker = new SCIEllipsePointMarker
                    {
                        Width     =                              5,
                        Height    =                              5,
                        BorderPen = new SCIPenSolid(IndianRedColor, 2f),
                        FillBrush = new SCIBrushSolid(IndianRedColor)
                    }
                }
            });

            Surface.ChartModifier = new SCIModifierGroup(new ISCIChartModifierProtocol[]
            {
                new SCITooltipModifier
                {
                    Style = { HitTestMode = (int)SCIHitTestMode.Interpolate }
                    //ShowAxisLabels = true,
                    //ShowTooltip = true,
                }
            });

            Surface.InvalidateElement();
        }
        protected override void InitExampleInternal()
        {
            Surface = new SCIChartSurface(_exampleViewLayout.SciChartSurfaceView);
            StyleHelper.SetSurfaceDefaultStyle(Surface);

            var xAxis = new SCINumericAxis {
                IsXAxis = true
            };
            var yAxis = new SCINumericAxis();

            var porkData     = new double[] { 10, 13, 7, 16, 4, 6, 20, 14, 16, 10, 24, 11 };
            var vealData     = new double[] { 12, 17, 21, 15, 19, 18, 13, 21, 22, 20, 5, 10 };
            var tomatoesData = new double[] { 7, 30, 27, 24, 21, 15, 17, 26, 22, 28, 21, 22 };
            var cucumberData = new double[] { 16, 10, 9, 8, 22, 14, 12, 27, 25, 23, 17, 17 };
            var pepperData   = new double[] { 7, 24, 21, 11, 19, 17, 14, 27, 26, 22, 28, 16 };

            var ds1 = new XyDataSeries <double, double> {
                SeriesName = "Pork Series"
            };
            var ds2 = new XyDataSeries <double, double> {
                SeriesName = "Veal Series"
            };
            var ds3 = new XyDataSeries <double, double> {
                SeriesName = "Tomato Series"
            };
            var ds4 = new XyDataSeries <double, double> {
                SeriesName = "Cucumber Series"
            };
            var ds5 = new XyDataSeries <double, double> {
                SeriesName = "Pepper Series"
            };

            const int data = 1992;

            for (var i = 0; i < porkData.Length; i++)
            {
                ds1.Append(data + i, porkData[i]);
                ds2.Append(data + i, vealData[i]);
                ds3.Append(data + i, tomatoesData[i]);
                ds4.Append(data + i, cucumberData[i]);
                ds5.Append(data + i, pepperData[i]);
            }

            var porkSeries     = GetRenderableSeries(ds1, UIColor.FromRGB(0x22, 0x57, 0x9D), UIColor.FromRGB(0x22, 0x6f, 0xb7));
            var vealSeries     = GetRenderableSeries(ds1, UIColor.FromRGB(0xBE, 0x64, 0x2D), UIColor.FromRGB(0xff, 0x9a, 0x2e));
            var tomatoSeries   = GetRenderableSeries(ds1, UIColor.FromRGB(0xA3, 0x36, 0x31), UIColor.FromRGB(0xdc, 0x44, 0x3f));
            var cucumberSeries = GetRenderableSeries(ds1, UIColor.FromRGB(0x73, 0x95, 0x3D), UIColor.FromRGB(0xaa, 0xd3, 0x4f));
            var pepperSeries   = GetRenderableSeries(ds1, UIColor.FromRGB(0x64, 0x45, 0x8A), UIColor.FromRGB(0x85, 0x62, 0xb4));

            var verticalCollection1 = new SCIStackedVerticalColumnGroupSeries();

            verticalCollection1.AddSeries(porkSeries);
            verticalCollection1.AddSeries(vealSeries);

            var verticalCollection2 = new SCIStackedVerticalColumnGroupSeries();

            verticalCollection2.AddSeries(tomatoSeries);
            verticalCollection2.AddSeries(cucumberSeries);
            verticalCollection2.AddSeries(pepperSeries);

            //var columnsCollection = new SCIStackedHorizontalColumnGroupSeries();
            //columnsCollection.AddSeries(verticalCollection1);
            //columnsCollection.AddSeries(verticalCollection2);

            Surface.AttachAxis(xAxis, true);
            Surface.AttachAxis(yAxis, false);
            Surface.AttachRenderableSeries(verticalCollection1);
            Surface.AttachRenderableSeries(verticalCollection2);

            Surface.ChartModifier = new SCIModifierGroup(new ISCIChartModifierProtocol[]
            {
                new SCIRolloverModifier(),
                new SCIZoomExtentsModifier()
            });

            Surface.InvalidateElement();
        }
        protected override void InitExampleInternal()
        {
            Surface = new SCIChartSurface(_exampleViewLayout.SciChartSurfaceView);
            StyleHelper.SetSurfaceDefaultStyle(Surface);

            var axisStyle = StyleHelper.GetDefaultAxisStyle();
            var xAxis     = new SCINumericAxis {
                IsXAxis = true, VisibleRange = new SCIDoubleRange(3, 6), AutoRange = SCIAutoRangeMode.Always, Style = axisStyle
            };
            var yAxis = new SCINumericAxis {
                GrowBy = new SCIDoubleRange(0, 0.1), Style = axisStyle
            };

            var ds1 = new XyDataSeries <double, double> {
                SeriesName = "Green Series"
            };
            var ds2 = new XyDataSeries <double, double> {
                SeriesName = "Red Series"
            };
            var ds3 = new XyDataSeries <double, double> {
                SeriesName = "Gray Series"
            };
            var ds4 = new XyDataSeries <double, double> {
                SeriesName = "Gold Series"
            };

            var data1 = DataManager.Instance.GetNoisySinewave(300, 1, 300, 0.25);
            var data2 = DataManager.Instance.GetSinewave(100, 2, 300);
            var data3 = DataManager.Instance.GetSinewave(200, 1.5, 300);
            var data4 = DataManager.Instance.GetSinewave(50, 0.1, 300);

            ds1.Append(data1.XData, data1.YData);
            ds2.Append(data2.XData, data2.YData);
            ds3.Append(data3.XData, data3.YData);
            ds4.Append(data4.XData, data4.YData);

            Surface.AttachAxis(xAxis, true);
            Surface.AttachAxis(yAxis, false);
            Surface.AttachRenderableSeries(new SCIFastLineRenderableSeries {
                DataSeries = ds1, Style = { LinePen = new SCIPenSolid(UIColor.Green, 2f) }
            });
            Surface.AttachRenderableSeries(new SCIFastLineRenderableSeries {
                DataSeries = ds2, Style = { LinePen = new SCIPenSolid(UIColor.Red, 2f) }
            });
            Surface.AttachRenderableSeries(new SCIFastLineRenderableSeries {
                DataSeries = ds3, Style = { LinePen = new SCIPenSolid(UIColor.Gray, 2f) }
            });
            Surface.AttachRenderableSeries(new SCIFastLineRenderableSeries {
                DataSeries = ds4, Style = { LinePen = new SCIPenSolid(GoldColor, 2f) }
            });

            Surface.ChartModifier = new SCIModifierGroup(new ISCIChartModifierProtocol[]
            {
                new SCICursorModifier
                {
                    Style = { HitTestMode = (int)SCIHitTestMode.Interpolate }
                    //ShowAxisLabels = true,
                    //ShowTooltip = true,
                }
            });

            Surface.InvalidateElement();
        }
        protected override void InitExampleInternal()
        {
            Surface = new SCIChartSurface(_exampleViewLayout.SciChartSurfaceView);
            StyleHelper.SetSurfaceDefaultStyle(Surface);

            var dataSeries = new OhlcDataSeries <DateTime, double>();

            foreach (var priceBar in DataManager.Instance.GetPriceDataIndu().Take(100))
            {
                dataSeries.Append(priceBar.DateTime, priceBar.Open, priceBar.High, priceBar.Low, priceBar.Close);
            }

            var axisStyle = StyleHelper.GetDefaultAxisStyle();
            var xAxis     = new SCICategoryDateTimeAxis {
                IsXAxis = true, VisibleRange = new SCIDoubleRange(0, 199), Style = axisStyle
            };
            var yAxis = new SCINumericAxis {
                VisibleRange = new SCIDoubleRange(30, 37), Style = axisStyle
            };

            Surface.AttachAxis(xAxis, true);
            Surface.AttachAxis(yAxis, false);
            Surface.AttachRenderableSeries(new SCIFastCandlestickRenderableSeries {
                DataSeries = dataSeries
            });

            Surface.Annotation = new SCIAnnotationGroup(new NSObject[]
            {
                new SCITextAnnotation
                {
                    CoordMode = SCIAnnotationCoordMode.Relative,
                    //HorizontalAnchorPoint = HorizontalAnchorPoint.Center,
                    Text      = "EUR.USD",
                    XPosition = 0.5,
                    YPosition = 0.5,
                    Style     =
                    {
                        TextStyle = { FontSize = 72 },
                        TextColor = UIColor.FromRGB(0xFF, 0xFF, 0xFF)
                    }

                    //FontStyle = new FontStyle.Builder(Activity).WithTextSize(72).WithTextColor(Color.Argb(0x77, 0xFF, 0xFF, 0xFF)).Build(),
                },
                new SCITextAnnotation
                {
                    //Editable = true,
                    Text      = "Buy",
                    XPosition = 10d,
                    YPosition = 30.5d,
                    //VerticalAnchorPoint = VerticalAnchorPoint.Bottom,
                    Style =
                    {
                        TextStyle = { FontSize = 20 },
                        TextColor = UIColor.FromRGB(0xFF, 0xFF, 0xFF)
                    }

                    //FontStyle = new FontStyle.Builder(Activity).WithTextSize(20).WithTextColor(Color.White).Build()
                },
                new SCITextAnnotation
                {
                    //Editable = true,
                    Text      = "Sell!",
                    XPosition = 50d,
                    YPosition = 34d,
                    Style     =
                    {
                        BackgroundColor = UIColor.FromRGBA(0x02, 0x00, 0x5a, 0x7f),
                        TextStyle       = { FontSize = 20 },
                        TextColor       = UIColor.FromRGB(0xFF,  0xFF, 0xFF)
                    },
                    //FontStyle = new FontStyle.Builder(Activity).WithTextSize(20).WithTextColor(Color.White).Build(),
                },
                new SCIBoxAnnotation
                {
                    //Editable = true,
                    //Background = Activity.GetDrawable(Resource.Drawable.example_box_annotation_background_4),
                    Style =
                    {
                        FillBrush = new SCIBrushSolid(UIColor.FromRGBA(0x02, 0x00, 0x59, 0x7f)),
                    },
                    XStart = 50,
                    YStart = 35.5,
                    XEnd   = 120,
                    YEnd   = 32,
                },
                new SCILineAnnotation
                {
                    //Editable = true,
                    Style =
                    {
                        LinePen = new SCIPenSolid(UIColor.FromRGBA(0xFF, 0x66, 0x00, 0xAA), 2f),
                    },
                    //Stroke = new PenStyle.Builder(Activity).WithThickness(2f).WithColor(Color.Argb(0xAA, 0xFF, 0x66, 0x00)).Build(),
                    XStart = 40,
                    YStart = 30.5,
                    XEnd   = 60,
                    YEnd   = 33.5,
                },
                new SCILineAnnotation
                {
                    //Editable = true,
                    Style =
                    {
                        LinePen = new SCIPenSolid(UIColor.FromRGBA(0xFF, 0x66, 0x00, 0xAA), 2f),
                    },
                    //Stroke = new PenStyle.Builder(Activity).WithThickness(2f).WithColor(Color.Argb(0xAA, 0xFF, 0x66, 0x00)).Build(),
                    XStart = 120,
                    YStart = 30.5,
                    XEnd   = 175,
                    YEnd   = 36,
                },
                //new LineArrowAnnotation(Activity)
                //{
                //    Editable = true,
                //    HeadLength = 8,
                //    HeadWidth = 16,
                //    X1Value = 50,
                //    Y1Value = 35,
                //    X2Value = 80,
                //    Y2Value = 31.4,
                //},
                new SCIAxisMarkerAnnotation
                {
                    //Editable = true,
                    Position = 32.7,
                    Style    =
                    {
                    }
                },
                //new SCIAxisMarkerAnnotation
                //{
                //    AnnotationSurface = AnnotationSurfaceEnum.XAxis,
                //    FormattedValue = "Horizontal",
                //    Editable = true,
                //    X1Value = 100
                //},
                //new HorizontalLineAnnotation(Activity)
                //{
                //    X1Value = 150,
                //    Y1Value = 32.2,
                //    Stroke = new PenStyle.Builder(Activity).WithThickness(2f).WithColor(Color.Red).Build(),
                //    HorizontalGravity = GravityFlags.Right,
                //    Editable = true
                //},
                //new HorizontalLineAnnotation(Activity)
                //{
                //    X1Value = 130,
                //    X2Value = 160,
                //    Y1Value = 33.9,
                //    Stroke = new PenStyle.Builder(Activity).WithThickness(2f).WithColor(Color.Blue).Build(),
                //    HorizontalGravity = GravityFlags.CenterHorizontal,
                //    Editable = true
                //},
                //new VerticalLineAnnotation(Activity)
                //{
                //    X1Value = 20,
                //    Y1Value = 35,
                //    Y2Value = 33,
                //    Stroke = new PenStyle.Builder(Activity).WithThickness(2f).WithColor(Color.DarkGreen).Build(),
                //    VerticalGravity = GravityFlags.CenterVertical,
                //    Editable = true,

                //},
                //new VerticalLineAnnotation(Activity)
                //{
                //    X1Value = 40,
                //    Y1Value = 34,
                //    Stroke = new PenStyle.Builder(Activity).WithThickness(2f).WithColor(Color.Green).Build(),
                //    VerticalGravity = GravityFlags.Top,
                //    Editable = true,
                //},
                new SCITextAnnotation
                {
                    XPosition = 50,
                    YPosition = 37,
                    //Editable = true,
                    Text = "Rotated text",
                    //FontStyle = new FontStyle.Builder(Activity).WithTextSize(20).WithTextColor(Color.White).Build(),
                    Style =
                    {
                        TextStyle = { FontSize = 20 },
                        TextColor = UIColor.FromRGB(0xFF, 0xFF, 0xFF),
                    },
                    //RotationAngle = 30
                }
            });

            Surface.InvalidateElement();
        }
        protected override void InitExampleInternal()
        {
            Surface = new SCIChartSurface(_exampleViewLayout.SciChartSurfaceView);
            StyleHelper.SetSurfaceDefaultStyle(Surface);

            var axisStyle = StyleHelper.GetDefaultAxisStyle();
            var xAxis     = new SCINumericAxis {
                IsXAxis = true, Style = axisStyle
            };
            var yAxis = new SCINumericAxis {
                GrowBy = new SCIDoubleRange(0.2, 0.2), Style = axisStyle
            };

            var ds1 = new XyDataSeries <double, double> {
                SeriesName = "Sinewave A"
            };
            var ds2 = new XyDataSeries <double, double> {
                SeriesName = "Sinewave B"
            };
            var ds3 = new XyDataSeries <double, double> {
                SeriesName = "Sinewave C"
            };

            const double count = 100;
            const double k     = 2 * Math.PI / 30;

            for (var i = 0; i < count; i++)
            {
                var phi = k * i;
                var sin = Math.Sin(phi);

                ds1.Append(i, (1.0 + i / count) * sin);
                ds2.Append(i, (0.5 + i / count) * sin);
                ds3.Append(i, (i / count) * sin);
            }

            Surface.AttachAxis(xAxis, true);
            Surface.AttachAxis(yAxis, false);
            Surface.AttachRenderableSeries(new SCIFastLineRenderableSeries
            {
                DataSeries = ds1,
                Style      =
                {
                    LinePen     = new SCIPenSolid(SteelBlueColor, 2f),
                    PointMarker = new SCIEllipsePointMarker
                    {
                        Width     =                              7,
                        Height    =                              7,
                        FillBrush = new SCIBrushSolid(LavenderColor)
                    }
                }
            });
            Surface.AttachRenderableSeries(new SCIFastLineRenderableSeries
            {
                DataSeries = ds2,
                Style      =
                {
                    LinePen     = new SCIPenSolid(DarkGreenColor, 2f),
                    PointMarker = new SCIEllipsePointMarker
                    {
                        Width     =                              7,
                        Height    =                              7,
                        FillBrush = new SCIBrushSolid(LavenderColor)
                    }
                }
            });
            Surface.AttachRenderableSeries(new SCIFastLineRenderableSeries
            {
                DataSeries = ds3,
                Style      = { LinePen = new SCIPenSolid(LightSteelBlueColor, 2f) }
            });

            Surface.ChartModifier = new SCIModifierGroup(new ISCIChartModifierProtocol[]
            {
                new SCIRolloverModifier
                {
                    //ShowTooltip = true,
                    //ShowAxisLabels = true,
                    //DrawVerticalLine = true
                }
            });

            Surface.InvalidateElement();
        }
示例#25
0
        protected override void InitExampleInternal()
        {
            Surface = new SCIChartSurface(_exampleViewLayout.SciChartSurfaceView);
            StyleHelper.SetSurfaceDefaultStyle(Surface);

            var xAxis = new SCINumericAxis {
                IsXAxis = true
            };
            var yAxis = new SCINumericAxis();

            var ds1 = new XyDataSeries <double, double> {
                SeriesName = "Curve A"
            };
            var ds2 = new XyDataSeries <double, double> {
                SeriesName = "Curve B"
            };
            var ds3 = new XyDataSeries <double, double> {
                SeriesName = "Curve C"
            };
            var ds4 = new XyDataSeries <double, double> {
                SeriesName = "Curve D"
            };

            var ds1Points = DataManager.Instance.GetStraightLine(4000, 1.0, 10);
            var ds2Points = DataManager.Instance.GetStraightLine(3000, 1.0, 10);
            var ds3Points = DataManager.Instance.GetStraightLine(2000, 1.0, 10);
            var ds4Points = DataManager.Instance.GetStraightLine(1000, 1.0, 10);

            ds1.Append(ds1Points.XData, ds1Points.YData);
            ds2.Append(ds2Points.XData, ds2Points.YData);
            ds3.Append(ds3Points.XData, ds3Points.YData);
            ds4.Append(ds4Points.XData, ds4Points.YData);

            Surface.AttachAxis(xAxis, true);
            Surface.AttachAxis(yAxis, false);
            Surface.AttachRenderableSeries(new SCIFastLineRenderableSeries
            {
                DataSeries = ds1,
                Style      = { LinePen = new SCIPenSolid(UIColor.FromRGB(0xFF, 0xFF, 0x00), 2f) }
            });
            Surface.AttachRenderableSeries(new SCIFastLineRenderableSeries
            {
                DataSeries = ds2,
                Style      = { LinePen = new SCIPenSolid(UIColor.FromRGB(0x27, 0x9B, 0x27), 2f) }
            });
            Surface.AttachRenderableSeries(new SCIFastLineRenderableSeries
            {
                DataSeries = ds3,
                Style      = { LinePen = new SCIPenSolid(UIColor.FromRGB(0xFF, 0x19, 0x19), 2f) }
            });
            Surface.AttachRenderableSeries(new SCIFastLineRenderableSeries
            {
                DataSeries = ds4,
                IsVisible  = false,
                Style      = { LinePen = new SCIPenSolid(UIColor.FromRGB(0x19, 0x64, 0xFF), 2f) }
            });

            var legendModifier = new SCILegendModifier {
                GetLegendDataFor = SCISourceMode.All
            };

            Surface.ChartModifier = new SCIModifierGroup(new ISCIChartModifierProtocol[] { legendModifier });

            Surface.InvalidateElement();
        }
示例#26
0
        protected override void InitExampleInternal()
        {
            Surface = new SCIChartSurface(_exampleViewLayout.SciChartSurfaceView);
            StyleHelper.SetSurfaceDefaultStyle(Surface);

            var axisStyle = StyleHelper.GetDefaultAxisStyle();
            var xAxis     = new SCIDateTimeAxis {
                IsXAxis = true, GrowBy = new SCIDoubleRange(0.1, 0.1), Style = axisStyle
            };
            var yAxis = new SCINumericAxis {
                GrowBy = new SCIDoubleRange(0.1, 0.1), Style = axisStyle
            };

            var yValues1 = new[] { 4.0, 7, 5.2, 9.4, 3.8, 5.1, 7.5, 12.4, 14.6, 8.1, 11.7, 14.4, 16.0, 3.7, 5.1, 6.4, 3.5, 2.5, 12.4, 16.4, 7.1, 8.0, 9.0 };
            var yValues2 = new[] { 15.0, 10.1, 10.2, 10.4, 10.8, 1.1, 11.5, 3.4, 4.6, 0.1, 1.7, 14.4, 6.0, 13.7, 10.1, 8.4, 8.5, 12.5, 1.4, 0.4, 10.1, 5.0, 1.0 };

            var ds1 = new XyDataSeries <double, double> {
                SeriesName = "data 1"
            };
            var ds2 = new XyDataSeries <double, double> {
                SeriesName = "data 2"
            };

            for (var i = 0; i < yValues1.Length; i++)
            {
                ds1.Append(i, yValues1[i]);
            }
            for (var i = 0; i < yValues2.Length; i++)
            {
                ds2.Append(i, yValues2[i]);
            }

            var bottomRenderSeries = new SCIStackedMountainRenderableSeries
            {
                DataSeries = ds1,
                Style      =
                {
                    AreaBrush = new SCIBrushLinearGradient(0xe1e0dbdd, 0xc3c1b688, SCILinearGradientDirection.Vertical),
                    BorderPen = new SCIPenSolid(0xaaffc9a8, 0.7f)
                }
            };
            var topRenderSeries = new SCIStackedMountainRenderableSeries
            {
                DataSeries = ds2,
                Style      =
                {
                    AreaBrush = new SCIBrushLinearGradient(0xcacbdadd, 0xaf9a4388, SCILinearGradientDirection.Vertical),
                    BorderPen = new SCIPenSolid(0xaaffc9a8, 0.7f)
                }
            };

            var stackedGroup = new SCIStackedGroupSeries();

            stackedGroup.AddSeries(bottomRenderSeries);
            stackedGroup.AddSeries(topRenderSeries);

            Surface.AttachAxis(xAxis, true);
            Surface.AttachAxis(yAxis, false);
            Surface.AttachRenderableSeries(stackedGroup);

            Surface.ChartModifier = new SCIModifierGroup(new ISCIChartModifierProtocol[]
            {
                new SCIZoomPanModifier(),
                new SCIPinchZoomModifier(),
                new SCIZoomExtentsModifier()
            });

            Surface.InvalidateElement();
        }
示例#27
0
        protected override void InitExampleInternal()
        {
            Surface = new SCIChartSurface(_exampleViewLayout.SciChartSurfaceView);
            StyleHelper.SetSurfaceDefaultStyle(Surface);

            var xAxis = new SCINumericAxis
            {
                IsXAxis   = true,
                AutoTicks = false,
                //MajorDelta = 1,
                //MinorDelta = 0.5,
                //LabelProvider = new YearsLabelProvider(),
                Style = { DrawMajorBands = true }
            };

            var yAxis = new SCINumericAxis
            {
                AutoRange = SCIAutoRangeMode.Always,
                AxisTitle = "billions of People",
                GrowBy    = new SCIDoubleRange(0, 0.1),
                Style     = { DrawMajorBands = true }
            };

            var china          = new[] { 1.269, 1.330, 1.356, 1.304 };
            var india          = new[] { 1.004, 1.173, 1.236, 1.656 };
            var usa            = new[] { 0.282, 0.310, 0.319, 0.439 };
            var indonesia      = new[] { 0.214, 0.243, 0.254, 0.313 };
            var brazil         = new[] { 0.176, 0.201, 0.203, 0.261 };
            var pakistan       = new[] { 0.146, 0.184, 0.196, 0.276 };
            var nigeria        = new[] { 0.123, 0.152, 0.177, 0.264 };
            var bangladesh     = new[] { 0.130, 0.156, 0.166, 0.234 };
            var russia         = new[] { 0.147, 0.139, 0.142, 0.109 };
            var japan          = new[] { 0.126, 0.127, 0.127, 0.094 };
            var restOfTheWorld = new[] { 2.466, 2.829, 3.005, 4.306 };

            var chinaDataSeries = new XyDataSeries <double, double> {
                SeriesName = "China"
            };
            var indiaDataSeries = new XyDataSeries <double, double> {
                SeriesName = "India"
            };
            var usaDataSeries = new XyDataSeries <double, double> {
                SeriesName = "USA"
            };
            var indonesiaDataSeries = new XyDataSeries <double, double> {
                SeriesName = "Indonesia"
            };
            var brazilDataSeries = new XyDataSeries <double, double> {
                SeriesName = "Brazil"
            };
            var pakistanDataSeries = new XyDataSeries <double, double> {
                SeriesName = "Pakistan"
            };
            var nigeriaDataSeries = new XyDataSeries <double, double> {
                SeriesName = "Nigeria"
            };
            var bangladeshDataSeries = new XyDataSeries <double, double> {
                SeriesName = "Bangladesh"
            };
            var russiaDataSeries = new XyDataSeries <double, double> {
                SeriesName = "Russia"
            };
            var japanDataSeries = new XyDataSeries <double, double> {
                SeriesName = "Japan"
            };
            var restOfTheWorldDataSeries = new XyDataSeries <double, double> {
                SeriesName = "Rest Of The World"
            };
            var totalDataSeries = new XyDataSeries <double, double> {
                SeriesName = "Total"
            };

            for (var i = 0; i < 4; i++)
            {
                double xValue = i;
                chinaDataSeries.Append(xValue, china[i]);
                if (i != 2)
                {
                    indiaDataSeries.Append(xValue, india[i]);
                    usaDataSeries.Append(xValue, usa[i]);
                    indonesiaDataSeries.Append(xValue, indonesia[i]);
                    brazilDataSeries.Append(xValue, brazil[i]);
                }
                else
                {
                    indiaDataSeries.Append(xValue, double.NaN);
                    usaDataSeries.Append(xValue, double.NaN);
                    indonesiaDataSeries.Append(xValue, double.NaN);
                    brazilDataSeries.Append(xValue, double.NaN);
                }
                pakistanDataSeries.Append(xValue, pakistan[i]);
                nigeriaDataSeries.Append(xValue, nigeria[i]);
                bangladeshDataSeries.Append(xValue, bangladesh[i]);
                russiaDataSeries.Append(xValue, russia[i]);
                japanDataSeries.Append(xValue, japan[i]);
                restOfTheWorldDataSeries.Append(xValue, restOfTheWorld[i]);
                totalDataSeries.Append(xValue, china[i] + india[i] + usa[i] + indonesia[i] + brazil[i] + pakistan[i] + nigeria[i] + bangladesh[i] + russia[i] + japan[i] + restOfTheWorld[i]);
            }

            var columnsCollection = new SCIStackedHorizontalColumnGroupSeries();

            columnsCollection.AddSeries(GetRenderableSeries(chinaDataSeries, UIColor.FromRGB(0x2D, 0x68, 0xBC), UIColor.FromRGB(0x33, 0x99, 0xff)));
            columnsCollection.AddSeries(GetRenderableSeries(indiaDataSeries, UIColor.FromRGB(0x01, 0x35, 0x47), UIColor.FromRGB(0x01, 0x43, 0x58)));
            columnsCollection.AddSeries(GetRenderableSeries(usaDataSeries, UIColor.FromRGB(0x1B, 0x5D, 0x46), UIColor.FromRGB(0x1f, 0x8a, 0x71)));
            columnsCollection.AddSeries(GetRenderableSeries(indonesiaDataSeries, UIColor.FromRGB(0x7E, 0x95, 0x2B), UIColor.FromRGB(0xbd, 0xd6, 0x3b)));
            columnsCollection.AddSeries(GetRenderableSeries(brazilDataSeries, UIColor.FromRGB(0xAA, 0x8F, 0x0B), UIColor.FromRGB(0xff, 0xe0, 0x0b)));
            columnsCollection.AddSeries(GetRenderableSeries(pakistanDataSeries, UIColor.FromRGB(0xA9, 0x54, 0x19), UIColor.FromRGB(0xf2, 0x74, 0x21)));
            columnsCollection.AddSeries(GetRenderableSeries(nigeriaDataSeries, UIColor.FromRGB(0x84, 0x00, 0x00), UIColor.FromRGB(0xbb, 0x00, 0x00)));
            columnsCollection.AddSeries(GetRenderableSeries(bangladeshDataSeries, UIColor.FromRGB(0x37, 0x00, 0x18), UIColor.FromRGB(0x55, 0x00, 0x33)));
            columnsCollection.AddSeries(GetRenderableSeries(russiaDataSeries, UIColor.FromRGB(0x2D, 0x73, 0x2D), UIColor.FromRGB(0x33, 0x99, 0x33)));
            columnsCollection.AddSeries(GetRenderableSeries(japanDataSeries, UIColor.FromRGB(0x00, 0x6C, 0x6A), UIColor.FromRGB(0x00, 0xab, 0xa9)));
            columnsCollection.AddSeries(GetRenderableSeries(restOfTheWorldDataSeries, UIColor.FromRGB(0x3D, 0x00, 0x49), UIColor.FromRGB(0x56, 0x00, 0x68)));

            Surface.AttachAxis(xAxis, true);
            Surface.AttachAxis(yAxis, false);
            Surface.AttachRenderableSeries(columnsCollection);

            Surface.ChartModifier = new SCIModifierGroup(new ISCIChartModifierProtocol[] { new SCITooltipModifier() });

            Surface.InvalidateElement();
        }