Example #1
0
        protected override void InitExample()
        {
            var xAxis = new SCINumericAxis {
                AutoRange = SCIAutoRange.Always
            };
            var leftAxis = new SCINumericAxis {
                AxisAlignment = SCIAxisAlignment.Left, AxisId = SCIAxisAlignment.Left.ToString()
            };
            var rightAxis = new SCINumericAxis {
                AxisAlignment = SCIAxisAlignment.Right, AxisId = SCIAxisAlignment.Right.ToString()
            };

            var initialColor        = UIColor.Blue;
            var selectedStrokeStyle = new SCISolidPenStyle(ColorUtil.White, 4f);
            var selectedPointMarker = new SCIEllipsePointMarker
            {
                Width       = 10,
                Height      = 10,
                FillStyle   = new SCISolidBrushStyle(0xFFFF00DC),
                StrokeStyle = new SCISolidPenStyle(ColorUtil.White, 1f)
            };

            using (Surface.SuspendUpdates())
            {
                Surface.XAxes.Add(xAxis);
                Surface.YAxes.Add(leftAxis);
                Surface.YAxes.Add(rightAxis);

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

                    var rs = new SCIFastLineRenderableSeries
                    {
                        DataSeries          = dataSeries,
                        YAxisId             = alignment.ToString(),
                        StrokeStyle         = new SCISolidPenStyle(initialColor, 2f),
                        SelectedSeriesStyle = new SCILineSeriesStyle
                        {
                            StrokeStyle = selectedStrokeStyle,
                            PointMarker = selectedPointMarker,
                        }
                    };

                    var animation = new SCISweepRenderableSeriesAnimation(3, SCIAnimationCurve.EaseOut);
                    animation.StartAfterDelay(0.3f);
                    rs.AddAnimation(animation);

                    // 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.RenderableSeries.Add(rs);
                }

                Surface.ChartModifiers.Add(new SCISeriesSelectionModifier());
            }
        }
Example #2
0
        protected override void InitExample()
        {
            var fourierSeries = DataManager.Instance.GetFourierSeries(1.0, 0.1);

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

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

            var xAxis = new SCINumericAxis {
                GrowBy = new SCIDoubleRange(0.1, 0.1)
            };
            var yAxis = new SCINumericAxis {
                GrowBy = new SCIDoubleRange(0.1, 0.1)
            };

            var renderSeries = new SCIFastLineRenderableSeries
            {
                DataSeries      = dataSeries,
                StrokeStyle     = new SCISolidPenStyle(0xFF99EE99, 0.7f),
                PaletteProvider = new ZeroLinePaletteProvider()
            };

            Surface.XAxes.Add(xAxis);
            Surface.YAxes.Add(yAxis);
            Surface.RenderableSeries.Add(renderSeries);

            Surface.ChartModifiers = new SCIChartModifierCollection
            {
                new SCIZoomPanModifier(),
                new SCIPinchZoomModifier(),
                new SCIZoomExtentsModifier()
            };
        }
        protected override void InitExample()
        {
            var xAxis = new SCINumericAxis {
                VisibleRange = new SCIDoubleRange(0.0, 10.0), AutoRange = SCIAutoRange.Never, AxisTitle = "Time (seconds)"
            };
            var yAxis = new SCINumericAxis {
                VisibleRange = new SCIDoubleRange(-0.5, 1.5), AxisTitle = "Voltage (mV)"
            };

            var rs0 = new SCIFastLineRenderableSeries {
                DataSeries = _series0, StrokeStyle = new SCISolidPenStyle(0xFFC6E6FF, 2f)
            };
            var rs1 = new SCIFastLineRenderableSeries {
                DataSeries = _series1, StrokeStyle = new SCISolidPenStyle(0xFFC6E6FF, 2f)
            };

            using (Surface.SuspendUpdates())
            {
                Surface.XAxes.Add(xAxis);
                Surface.YAxes.Add(yAxis);
                Surface.RenderableSeries.Add(rs0);
                Surface.RenderableSeries.Add(rs1);
            }

            Start();
        }
Example #4
0
        protected override void InitExample()
        {
            var xAxis = new SCINumericAxis {
                GrowBy = new SCIDoubleRange(0.1, 0.1), VisibleRange = new SCIDoubleRange(1.1, 2.7)
            };
            var yAxis = new SCINumericAxis {
                GrowBy = new SCIDoubleRange(0.1, 0.1)
            };

            var fourierSeries = DataManager.Instance.GetFourierSeries(1.0, 0.1);
            var dataSeries    = new XyDataSeries <double, double>();

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

            var renderSeries = new SCIFastLineRenderableSeries {
                DataSeries = dataSeries, StrokeStyle = new SCISolidPenStyle(0xFF279B27, 2f)
            };

            using (Surface.SuspendUpdates())
            {
                Surface.XAxes.Add(xAxis);
                Surface.YAxes.Add(yAxis);
                Surface.RenderableSeries.Add(renderSeries);

                Surface.ChartModifiers = new SCIChartModifierCollection
                {
                    new SCIZoomPanModifier(),
                    new SCIPinchZoomModifier(),
                    new SCIZoomExtentsModifier()
                };
            }
        }
Example #5
0
        protected override void InitExample()
        {
            ((SingleRealtimeChartLayout)View).Start.TouchUpInside += (sender, args) => Start();
            ((SingleRealtimeChartLayout)View).Pause.TouchUpInside += (sender, args) => Pause();
            ((SingleRealtimeChartLayout)View).Reset.TouchUpInside += (sender, args) => Reset();

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

            var rs1 = new SCIFastLineRenderableSeries {
                DataSeries = _ds1, StrokeStyle = new SCISolidPenStyle(0xFF4083B7, 2f)
            };
            var rs2 = new SCIFastLineRenderableSeries {
                DataSeries = _ds2, StrokeStyle = new SCISolidPenStyle(0xFFFFA500, 2f)
            };
            var rs3 = new SCIFastLineRenderableSeries {
                DataSeries = _ds3, StrokeStyle = new SCISolidPenStyle(0xFFE13219, 2f)
            };

            using (Surface.SuspendUpdates())
            {
                Surface.XAxes.Add(xAxis);
                Surface.YAxes.Add(yAxis);
                Surface.RenderableSeries.Add(rs1);
                Surface.RenderableSeries.Add(rs2);
                Surface.RenderableSeries.Add(rs3);
            }
            Start();
        }
        protected override void InitExample()
        {
            var xAxis = new SCINumericAxis();
            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);

            var rs1 = new SCIFastLineRenderableSeries {
                DataSeries = ds1, StrokeStyle = new SCISolidPenStyle(0xFFFFFF00, 2f)
            };
            var rs2 = new SCIFastLineRenderableSeries {
                DataSeries = ds2, StrokeStyle = new SCISolidPenStyle(0xFF279B27, 2f)
            };
            var rs3 = new SCIFastLineRenderableSeries {
                DataSeries = ds3, StrokeStyle = new SCISolidPenStyle(0xFFFF1919, 2f)
            };
            var rs4 = new SCIFastLineRenderableSeries {
                DataSeries = ds4, IsVisible = false, StrokeStyle = new SCISolidPenStyle(0xFF1964FF, 2f)
            };

            using (Surface.SuspendUpdates())
            {
                Surface.XAxes.Add(xAxis);
                Surface.YAxes.Add(yAxis);
                Surface.RenderableSeries.Add(rs1);
                Surface.RenderableSeries.Add(rs2);
                Surface.RenderableSeries.Add(rs3);
                Surface.RenderableSeries.Add(rs4);
                Surface.ChartModifiers.Add(new SCILegendModifier {
                    SourceMode = SCISourceMode.AllSeries
                });

                rs1.AddAnimation(new SCISweepRenderableSeriesAnimation(3, SCIAnimationCurve.EaseOut));
                rs2.AddAnimation(new SCISweepRenderableSeriesAnimation(3, SCIAnimationCurve.EaseOut));
                rs3.AddAnimation(new SCISweepRenderableSeriesAnimation(3, SCIAnimationCurve.EaseOut));
                rs4.AddAnimation(new SCISweepRenderableSeriesAnimation(3, SCIAnimationCurve.EaseOut));
            }
        }
        protected override void InitExample()
        {
            var xAxis = new SCIDateTimeAxis {
                GrowBy = new SCIDoubleRange(0.1, 0.1), TextFormatting = "dd/MM/YYYY"
            };
            var yAxis = new SCINumericAxis {
                GrowBy = new SCIDoubleRange(0.1, 0.1)
            };

            var dataSeries = new XyDataSeries <DateTime, double> {
                DataDistributionCalculator = new SCIUserDefinedDistributionCalculator()
            };
            var xyyDataSeries = new XyyDataSeries <DateTime, double> {
                DataDistributionCalculator = new SCIUserDefinedDistributionCalculator()
            };
            var xyyDataSeries1 = new XyyDataSeries <DateTime, double> {
                DataDistributionCalculator = new SCIUserDefinedDistributionCalculator()
            };
            var xyyDataSeries2 = new XyyDataSeries <DateTime, double> {
                DataDistributionCalculator = new SCIUserDefinedDistributionCalculator()
            };

            DataManager.Instance.GetFanData(10, result =>
            {
                dataSeries.Append(result.Date, result.ActualValue);
                xyyDataSeries.Append(result.Date, result.MaxValue, result.MinValue);
                xyyDataSeries1.Append(result.Date, result.Value1, result.Value4);
                xyyDataSeries2.Append(result.Date, result.Value2, result.Value3);
            });

            var dataRenderSeries = new SCIFastLineRenderableSeries
            {
                DataSeries  = dataSeries,
                StrokeStyle = new SCISolidPenStyle(UIColor.Red, 1.0f)
            };

            var animation = new SCIWaveRenderableSeriesAnimation(3, SCIAnimationCurve.EaseOut);

            animation.StartAfterDelay(0.3f);
            dataRenderSeries.AddAnimation(animation);

            using (Surface.SuspendUpdates())
            {
                Surface.XAxes.Add(xAxis);
                Surface.YAxes.Add(yAxis);

                Surface.RenderableSeries.Add(createRenderableSeriesWith(xyyDataSeries));
                Surface.RenderableSeries.Add(createRenderableSeriesWith(xyyDataSeries1));
                Surface.RenderableSeries.Add(createRenderableSeriesWith(xyyDataSeries2));
                Surface.RenderableSeries.Add(dataRenderSeries);

                Surface.ChartModifiers = new SCIChartModifierCollection
                {
                    new SCIZoomPanModifier(),
                    new SCIPinchZoomModifier(),
                    new SCIZoomExtentsModifier()
                };
            }
        }
Example #8
0
        protected override void InitExample()
        {
            var xAxis = new SCIDateTimeAxis {
                GrowBy = new SCIDoubleRange(0.0, 0.1)
            };
            var yAxis = new SCINumericAxis {
                GrowBy = new SCIDoubleRange(0, 0.1)
            };

            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 lineSeries = new SCIFastLineRenderableSeries
            {
                DataSeries  = dataSeries,
                StrokeStyle = new SCISolidPenStyle(0xFFFF3333, 1f)
            };

            var lineAnimation = new SCIScaleRenderableSeriesAnimation(3, SCIAnimationCurve.EaseOutElastic);

            lineAnimation.StartAfterDelay(0.3f);
            lineSeries.AddAnimation(lineAnimation);

            var bubbleSeries = new SCIBubbleRenderableSeries
            {
                DataSeries = dataSeries,
                //Style = new SCIBubbleSeriesStyle { Detalization = 40,  },
                ZScaleFactor     = 1,
                AutoZRange       = false,
                BubbleBrushStyle = new SCISolidBrushStyle(0x50CCCCCC),
                StrokeStyle      = new SCISolidPenStyle(0x90CCCCCC, 2f)
            };

            var bubbleAnimation = new SCIScaleRenderableSeriesAnimation(3, SCIAnimationCurve.EaseOutElastic);

            bubbleAnimation.StartAfterDelay(0.3f);
            bubbleSeries.AddAnimation(bubbleAnimation);

            using (Surface.SuspendUpdates())
            {
                Surface.XAxes.Add(xAxis);
                Surface.YAxes.Add(yAxis);
                Surface.RenderableSeries.Add(lineSeries);
                Surface.RenderableSeries.Add(bubbleSeries);

                Surface.ChartModifiers = new SCIChartModifierCollection
                {
                    new SCIZoomPanModifier(),
                    new SCIPinchZoomModifier(),
                    new SCIZoomExtentsModifier()
                };
            }
        }
        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();
        }
Example #10
0
        void CreateRenderableSeries()
        {
            _lineRenderableSeries            = new SCIFastLineRenderableSeries();
            _lineRenderableSeries.DataSeries = _lineDataSeries;

            _scatterRenderableSeries            = new SCIXyScatterRenderableSeries();
            _scatterRenderableSeries.DataSeries = _scatterDataSeries;

            _surface.RenderableSeries.Add(_lineRenderableSeries);
            _surface.RenderableSeries.Add(_scatterRenderableSeries);
        }
Example #11
0
        private void SetupRenderableSeries()
        {
            var dataManager = DataManager.Instance;
            var priceBars   = dataManager.GetPriceDataIndu();

            var mountainDataSeries = new XyDataSeries <double, double> {
                SeriesName = "Mountain Series"
            };
            var lineDataSeries = new XyDataSeries <double, double> {
                SeriesName = "Line Series"
            };
            var columnDataSeries = new XyDataSeries <double, long> {
                SeriesName = "Column Series"
            };
            var candlestickDataSeries = new OhlcDataSeries <double, double> {
                SeriesName = "Candlestick Series"
            };

            var xValues = Enumerable.Range(0, priceBars.Count).Select(x => (double)x).ToArray();

            mountainDataSeries.Append(xValues, priceBars.LowData.Select(x => x - 1000d));
            lineDataSeries.Append(xValues, dataManager.ComputeMovingAverage(priceBars.CloseData, 50));
            columnDataSeries.Append(xValues, priceBars.VolumeData);
            candlestickDataSeries.Append(xValues, priceBars.OpenData, priceBars.HighData, priceBars.LowData, priceBars.CloseData);

            var mountainRenderableSeries = new SCIFastMountainRenderableSeries {
                DataSeries = mountainDataSeries, YAxisId = "PrimaryAxisId"
            };
            var lineRenderableSeries = new SCIFastLineRenderableSeries {
                DataSeries = lineDataSeries, YAxisId = "PrimaryAxisId"
            };
            var columnRenderableSeries = new SCIFastColumnRenderableSeries {
                DataSeries = columnDataSeries, YAxisId = "SecondaryAxisId"
            };
            var candlestickRenderableSeries = new SCIFastCandlestickRenderableSeries {
                DataSeries = candlestickDataSeries, YAxisId = "PrimaryAxisId"
            };

            using (Surface.SuspendUpdates())
            {
                Surface.RenderableSeries.Add(mountainRenderableSeries);
                Surface.RenderableSeries.Add(lineRenderableSeries);
                Surface.RenderableSeries.Add(columnRenderableSeries);
                Surface.RenderableSeries.Add(candlestickRenderableSeries);
                Surface.ChartModifiers = new SCIChartModifierCollection
                {
                    new SCILegendModifier {
                        ShowCheckBoxes = false
                    },
                    new SCICursorModifier(),
                    new SCIZoomExtentsModifier()
                };
            }
        }
Example #12
0
        void CreateRenderableSeries()
        {
            _lineRenderableSeries            = new SCIFastLineRenderableSeries();
            _lineRenderableSeries.DataSeries = _lineDataSeries;
            _lineRenderableSeries.YAxisId    = "firstYAxis";

            _scatterRenderableSeries            = new SCIXyScatterRenderableSeries();
            _scatterRenderableSeries.DataSeries = _scatterDataSeries;
            _scatterRenderableSeries.YAxisId    = "secondaryYAxis";

            _surface.RenderableSeries.Add(_lineRenderableSeries);
            _surface.RenderableSeries.Add(_scatterRenderableSeries);
        }
Example #13
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();
        }
Example #14
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();
        }
        protected override void InitExample()
        {
            ((SingleRealtimeChartLayout)View).Start.TouchUpInside += (sender, args) => Start();
            ((SingleRealtimeChartLayout)View).Pause.TouchUpInside += (sender, args) => Pause();
            ((SingleRealtimeChartLayout)View).Reset.TouchUpInside += (sender, args) => Reset();

            _countLabel           = new UILabel(new CGRect(0, 0, 220, 140));
            _countLabel.TextColor = UIColor.White;
            _countLabel.Font      = UIFont.FromName("Helvetica", 14f);
            ((SingleRealtimeChartLayout)View).Add(_countLabel);

            var xAxis = new SCINumericAxis {
                AutoRange = SCIAutoRange.Always
            };
            var yAxis = new SCINumericAxis {
                AutoRange = SCIAutoRange.Always
            };

            var rs1 = new SCIFastLineRenderableSeries {
                DataSeries = _mainSeries, StrokeStyle = new SCISolidPenStyle(0xFF4083B7, 2f)
            };
            var rs2 = new SCIFastLineRenderableSeries {
                DataSeries = _maLowSeries, StrokeStyle = new SCISolidPenStyle(0xFFFFA500, 2f)
            };
            var rs3 = new SCIFastLineRenderableSeries {
                DataSeries = _maHighSeries, StrokeStyle = new SCISolidPenStyle(0xFFE13219, 2f)
            };

            using (Surface.SuspendUpdates())
            {
                Surface.XAxes.Add(xAxis);
                Surface.YAxes.Add(yAxis);
                Surface.RenderableSeries.Add(rs1);
                Surface.RenderableSeries.Add(rs2);
                Surface.RenderableSeries.Add(rs3);
            }
        }
Example #16
0
        protected override void InitExample()
        {
            var xAxis = new SCINumericAxis {
                GrowBy = new SCIDoubleRange(0.1, 0.1), VisibleRange = new SCIDoubleRange(150, 180)
            };

            var yRightAxis = new SCINumericAxis
            {
                GrowBy        = new SCIDoubleRange(0.1, 0.1),
                AxisAlignment = SCIAxisAlignment.Right,
                AutoRange     = SCIAutoRange.Always,
                AxisId        = "PrimaryAxisId",
                Style         =
                {
                    DrawMajorTicks = false,
                    DrawMinorTicks = false,
                },
                LabelProvider = new ThousandsLabelProvider()
            };

            var yLeftAxis = new SCINumericAxis
            {
                GrowBy        = new SCIDoubleRange(0, 3d),
                AxisAlignment = SCIAxisAlignment.Left,
                AutoRange     = SCIAutoRange.Always,
                AxisId        = "SecondaryAxisId",
                Style         =
                {
                    DrawMajorTicks = false,
                    DrawMinorTicks = false,
                },
                LabelProvider = new BillionsLabelProvider()
            };

            var dataManager = DataManager.Instance;
            var priceBars   = dataManager.GetPriceDataIndu();

            var mountainDataSeries = new XyDataSeries <double, double> {
                SeriesName = "Mountain Series"
            };
            var lineDataSeries = new XyDataSeries <double, double> {
                SeriesName = "Line Series"
            };
            var columnDataSeries = new XyDataSeries <double, long> {
                SeriesName = "Column Series"
            };
            var candlestickDataSeries = new OhlcDataSeries <double, double> {
                SeriesName = "Candlestick Series"
            };

            var xValues = Enumerable.Range(0, priceBars.Count).Select(x => (double)x).ToArray();

            mountainDataSeries.Append(xValues, priceBars.LowData.Select(x => x - 1000d));
            lineDataSeries.Append(xValues, dataManager.ComputeMovingAverage(priceBars.CloseData, 50));
            columnDataSeries.Append(xValues, priceBars.VolumeData);
            candlestickDataSeries.Append(xValues, priceBars.OpenData, priceBars.HighData, priceBars.LowData, priceBars.CloseData);

            var mountainRenderableSeries = new SCIFastMountainRenderableSeries {
                DataSeries = mountainDataSeries, YAxisId = "PrimaryAxisId"
            };
            var lineRenderableSeries = new SCIFastLineRenderableSeries {
                DataSeries = lineDataSeries, YAxisId = "PrimaryAxisId"
            };
            var columnRenderableSeries = new SCIFastColumnRenderableSeries {
                DataSeries = columnDataSeries, YAxisId = "SecondaryAxisId"
            };
            var candlestickRenderableSeries = new SCIFastCandlestickRenderableSeries {
                DataSeries = candlestickDataSeries, YAxisId = "PrimaryAxisId"
            };

            using (Surface.SuspendUpdates())
            {
                Surface.XAxes.Add(xAxis);
                Surface.YAxes.Add(yRightAxis);
                Surface.YAxes.Add(yLeftAxis);
                Surface.RenderableSeries.Add(mountainRenderableSeries);
                Surface.RenderableSeries.Add(lineRenderableSeries);
                Surface.RenderableSeries.Add(columnRenderableSeries);
                Surface.RenderableSeries.Add(candlestickRenderableSeries);
                Surface.ChartModifiers = new SCIChartModifierCollection
                {
                    new SCILegendModifier {
                        ShowCheckBoxes = false
                    },
                    new SCICursorModifier(),
                    new SCIZoomExtentsModifier()
                };
            }

            SCIThemeManager.ApplyTheme(Surface, customThemeKey);
        }
Example #17
0
        protected override void InitExample()
        {
            var xAxis = new SCINumericAxis();
            var yAxis = new SCINumericAxis();

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

            var dataSeries0 = new HlDataSeries <double, double>();
            var dataSeries1 = new HlDataSeries <double, double>();

            FillDataSeries(dataSeries0, fourierSeries, 1.0);
            FillDataSeries(dataSeries1, fourierSeries, 1.3);

            const uint color = 0xFFC6E6FF;

            var strokeStyle = new SCISolidPenStyle(0xFFC6E6FF.ToColor(), 1f);

            var errorBars0 = new SCIFastErrorBarsRenderableSeries
            {
                DataSeries     = dataSeries0,
                StrokeStyle    = strokeStyle,
                ErrorDirection = SCIErrorBarDirection.Vertical,
                ErrorType      = SCIErrorBarType.Absolute
            };

            errorBars0.AddAnimation(new SCIScaleRenderableSeriesAnimation(3, SCIAnimationCurve.EaseOutElastic));

            var lineSeries = new SCIFastLineRenderableSeries
            {
                DataSeries  = dataSeries0,
                StrokeStyle = strokeStyle,
                PointMarker = new SCIEllipsePointMarker
                {
                    FillStyle = new SCISolidBrushStyle(color),
                    Width     = 5,
                    Height    = 5
                }
            };

            lineSeries.AddAnimation(new SCIScaleRenderableSeriesAnimation(3, SCIAnimationCurve.EaseOutElastic));

            var errorBars1 = new SCIFastErrorBarsRenderableSeries
            {
                DataSeries     = dataSeries1,
                StrokeStyle    = strokeStyle,
                DataPointWidth = 0.7f,
                ErrorDirection = SCIErrorBarDirection.Vertical,
                ErrorType      = SCIErrorBarType.Absolute
            };

            errorBars1.AddAnimation(new SCIScaleRenderableSeriesAnimation(3, SCIAnimationCurve.EaseOutElastic));

            var scatterSeries = new SCIXyScatterRenderableSeries
            {
                DataSeries  = dataSeries1,
                PointMarker = new SCIEllipsePointMarker
                {
                    FillStyle   = new SCISolidBrushStyle(ColorUtil.Transparent),
                    StrokeStyle = strokeStyle,
                    Width       = 7,
                    Height      = 7
                }
            };

            scatterSeries.AddAnimation(new SCIScaleRenderableSeriesAnimation(3, SCIAnimationCurve.EaseOutElastic));

            using (Surface.SuspendUpdates())
            {
                Surface.XAxes.Add(xAxis);
                Surface.YAxes.Add(yAxis);
                Surface.RenderableSeries = new SCIRenderableSeriesCollection
                {
                    errorBars0,
                    lineSeries,
                    errorBars1,
                    scatterSeries
                };
                Surface.ChartModifiers = new SCIChartModifierCollection
                {
                    new SCIZoomPanModifier(),
                    new SCIPinchZoomModifier(),
                    new SCIZoomExtentsModifier()
                };
            }
        }
        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();
        }
Example #20
0
        private void InitializeGraph()
        {
            // init shared resources
            var oxygenColor      = UIColor.Blue;
            var temperatureColor = UIColor.Red;
            var pressureColor    = UIColor.Green;

            // init surface
            _chartSurface = new SCIChartSurface()
            {
                RenderableSeriesAreaBorderStyle = new SCISolidPenStyle(UIColor.Black, 0)
            };

            // init axes
            var dateAxis = new SCIDateAxis()
            {
                AutoRange          = _native.IsZoomable ? SCIAutoRange.Once : SCIAutoRange.Always,
                GrowBy             = new SCIDoubleRange(0.05, 0.05),
                DrawMinorGridLines = false,
                TickLabelStyle     = new SCIFontStyle(14, UIColor.Black),
                TitleStyle         = new SCIFontStyle(14, UIColor.Black),
                AxisId             = X_AXIS_ID
            };
            var oxygenAxis = new SCINumericAxis()
            {
                AutoRange          = _native.IsZoomable ? SCIAutoRange.Once : SCIAutoRange.Always,
                AxisAlignment      = SCIAxisAlignment.Left,
                GrowBy             = new SCIDoubleRange(0.05, 0.05),
                AxisId             = OXYGEN_AXIS_ID,
                AxisTitle          = "Oxygen",
                IsVisible          = _native.IsOxygenVisible,
                TickLabelStyle     = new SCIFontStyle(14, oxygenColor),
                TitleStyle         = new SCIFontStyle(14, oxygenColor),
                DrawMinorGridLines = false,
                IsPrimaryAxis      = true
            };
            var temperatureAxis = new SCINumericAxis()
            {
                AutoRange          = _native.IsZoomable ? SCIAutoRange.Once : SCIAutoRange.Always,
                AxisAlignment      = SCIAxisAlignment.Right,
                GrowBy             = new SCIDoubleRange(0.05, 0.05),
                AxisId             = TEMPERATURE_AXIS_ID,
                AxisTitle          = "Temperature",
                IsVisible          = _native.IsTemperatureVisible,
                TickLabelStyle     = new SCIFontStyle(14, temperatureColor),
                TitleStyle         = new SCIFontStyle(14, temperatureColor),
                DrawMinorGridLines = false,
                IsPrimaryAxis      = false
            };
            var pressureAxis = new SCINumericAxis()
            {
                AutoRange          = _native.IsZoomable ? SCIAutoRange.Once : SCIAutoRange.Always,
                AxisAlignment      = SCIAxisAlignment.Right,
                GrowBy             = new SCIDoubleRange(0.05, 0.05),
                AxisId             = PRESSURE_AXIS_ID,
                AxisTitle          = "Pressure",
                IsVisible          = _native.IsPressureVisible,
                TickLabelStyle     = new SCIFontStyle(14, pressureColor),
                TitleStyle         = new SCIFontStyle(14, pressureColor),
                DrawMinorGridLines = false,
                IsPrimaryAxis      = false
            };

            // init data
            _oxygenData = new XyDataSeries <DateTime, double> {
                SeriesName = "Oxygen"
            };
            _temperatureData = new XyDataSeries <DateTime, double> {
                SeriesName = "Temperature"
            };
            _pressureData = new XyDataSeries <DateTime, double> {
                SeriesName = "Pressure"
            };

            // init series
            _oxygenSeries = new SCIFastLineRenderableSeries
            {
                XAxisId     = X_AXIS_ID,
                YAxisId     = OXYGEN_AXIS_ID,
                DataSeries  = _oxygenData,
                IsVisible   = _native.IsOxygenVisible,
                StrokeStyle = new SCISolidPenStyle(oxygenColor, 1.5f)
            };
            _temperatureSeries = new SCIFastLineRenderableSeries
            {
                XAxisId     = X_AXIS_ID,
                YAxisId     = TEMPERATURE_AXIS_ID,
                DataSeries  = _temperatureData,
                IsVisible   = _native.IsTemperatureVisible,
                StrokeStyle = new SCISolidPenStyle(temperatureColor, 1.5f)
            };
            _pressureSeries = new SCIFastLineRenderableSeries
            {
                XAxisId     = X_AXIS_ID,
                YAxisId     = PRESSURE_AXIS_ID,
                DataSeries  = _pressureData,
                IsVisible   = _native.IsPressureVisible,
                StrokeStyle = new SCISolidPenStyle(pressureColor, 1.5f)
            };

            // add chart components to chart
            _chartSurface.XAxes.Add(dateAxis);
            _chartSurface.YAxes.Add(oxygenAxis);
            _chartSurface.YAxes.Add(temperatureAxis);
            _chartSurface.YAxes.Add(pressureAxis);
            _chartSurface.RenderableSeries.Add(_oxygenSeries);
            _chartSurface.RenderableSeries.Add(_temperatureSeries);
            _chartSurface.RenderableSeries.Add(_pressureSeries);

            // apply theme
            SCIThemeManager.ApplyTheme(_chartSurface, SCIThemeManager.Bright_Spark);

            // add modifiers
            if (_native.IsZoomable)
            {
                _chartSurface.ChartModifiers = new SCIChartModifierCollection
                {
                    new SCIZoomPanModifier()
                    {
                        ClipModeX    = SCIClipMode.None,
                        ClipModeY    = SCIClipMode.None,
                        ZoomExtentsY = false
                    },
                    new SCIPinchZoomModifier()
                    {
                        Direction = SCIDirection2D.XyDirection
                    },
                    new SCIZoomExtentsModifier
                    {
                        IsAnimated = true
                    }
                };
            }

            // load!
            SetNativeControl(_chartSurface);
        }
        private void CreateMainPriceChart()
        {
            // Create an XAxis and YAxis for our chart
            var xAxis = new SCICategoryDateTimeAxis
            {
                Style  = { DrawMajorGridLines = false },
                GrowBy = new SCIDoubleRange(0, 0.1)
            };
            var yAxis = new SCINumericAxis {
                AutoRange = SCIAutoRange.Always
            };

            // Create RenderableSeries to render the data
            var ohlcSeries = new SCIFastOhlcRenderableSeries
            {
                DataSeries      = _ohlcDataSeries,
                StrokeUpStyle   = new SCISolidPenStyle(StrokeUpColor, StrokeThickness),
                StrokeDownStyle = new SCISolidPenStyle(StrokeDownColor, StrokeThickness),
            };

            var movingAverage50Series = new SCIFastLineRenderableSeries {
                DataSeries = _xyDataSeries, StrokeStyle = new SCISolidPenStyle(0xFFFF6600, 1.0f)
            };

            // Create axis markers annotations to show the last values on real-time chart
            //TODO Position -> Y1Value, color property should be on annotation itself
            _smaAxisMarker = new SCIAxisMarkerAnnotation {
                Position = 0d, YAxisId = yAxis.AxisId
            };
            _smaAxisMarker.Style.BackgroundColor = SmaSeriesColor.ToColor();

            _ohlcAxisMarker = new SCIAxisMarkerAnnotation {
                Position = 0d, YAxisId = yAxis.AxisId
            };
            _ohlcAxisMarker.Style.BackgroundColor = StrokeUpColor.ToColor();

            using (MainSurface.SuspendUpdates())
            {
                MainSurface.XAxes.Add(xAxis);
                MainSurface.YAxes.Add(yAxis);
                MainSurface.RenderableSeries.Add(ohlcSeries);
                MainSurface.RenderableSeries.Add(movingAverage50Series);
                MainSurface.Annotations.Add(_ohlcAxisMarker);
                MainSurface.Annotations.Add(_smaAxisMarker);

                // Populate some pinch and touch interactions. Pinch to zoom, drag to pan and double-tap to zoom extents
                MainSurface.ChartModifiers = new SCIChartModifierCollection
                {
                    new SCIXAxisDragModifier(),
                    new SCIZoomPanModifier {
                        Direction = SCIDirection2D.XDirection
                    },
                    new SCIZoomExtentsModifier(),
                    new SCILegendModifier
                    {
                        Orientation     = SCIOrientation.Horizontal,
                        Position        = SCILegendPosition.Bottom,
                        StyleOfItemCell = new SCILegendCellStyle {
                            SeriesNameFont = UIFont.FromName("Helvetica", 10f)
                        }
                    }
                };
            }
        }