Example #1
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 #2
0
        protected override void InitExample()
        {
            var priceSeries = DataManager.Instance.GetPriceDataIndu();

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

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

            var size  = priceSeries.Count;
            var xAxis = new SCICategoryDateTimeAxis {
                VisibleRange = new SCIDoubleRange(size - 30, size), GrowBy = new SCIDoubleRange(0, 0.1)
            };
            var yAxis = new SCINumericAxis {
                GrowBy = new SCIDoubleRange(0, 0.1), AutoRange = SCIAutoRange.Always
            };

            var renderSeries = new SCIFastCandlestickRenderableSeries
            {
                DataSeries         = dataSeries,
                StrokeUpStyle      = new SCISolidPenStyle(0xFF00AA00, 1f),
                StrokeDownStyle    = new SCISolidPenStyle(0xFFFF0000, 1f),
                FillUpBrushStyle   = new SCISolidBrushStyle(0x8800AA00),
                FillDownBrushStyle = new SCISolidBrushStyle(0x88FF0000)
            };

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

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

            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 #3
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();
        }
Example #4
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);
        }