Пример #1
0
        private void UpdateFinancialIndicator(string indicatorType)
        {
            DateTimeCategoricalAxis horizontalAxis = this.radChartView1.Axes[0] as DateTimeCategoricalAxis;
            LinearAxis verticalAxis = this.radChartView1.Axes[1] as LinearAxis;

            this.radChartView1.Series.Clear();

            IndicatorBase indicator = CreateFinancialIndicator(indicatorType);

            indicator.HorizontalAxis = horizontalAxis;
            indicator.VerticalAxis   = verticalAxis;
            indicator.PointSize      = SizeF.Empty;
            indicator.BorderColor    = Color.Black;

            IParentIndicator parentIndicator = indicator as IParentIndicator;

            if (parentIndicator != null)
            {
                parentIndicator.ChildIndicator.BorderColor = Color.Red;
            }

            this.radChartView1.Series.Add(indicator);
        }
Пример #2
0
        private void UpdateStockSeries()
        {
            DateTimeCategoricalAxis horizontalAxis = this.radChartView2.Axes[0] as DateTimeCategoricalAxis;
            LinearAxis verticalAxis = this.radChartView2.Axes[1] as LinearAxis;

            this.radChartView2.Series.Clear();

            if (this.radDropDownList1.SelectedItem != null)
            {
                string seriesType = this.radDropDownList1.SelectedItem.Text;

                OhlcSeries series;
                if (seriesType == "Candlestick")
                {
                    series = new CandlestickSeries();
                }
                else
                {
                    series = new OhlcSeries();
                }

                series.BorderColor      = Color.FromArgb(102, 102, 102);
                series.BackColor        = Color.FromArgb(102, 102, 102);
                series.HorizontalAxis   = horizontalAxis;
                series.VerticalAxis     = verticalAxis;
                series.OpenValueMember  = "Open";
                series.HighValueMember  = "High";
                series.LowValueMember   = "Low";
                series.CloseValueMember = "Close";
                series.CategoryMember   = "Date";
                series.DataSource       = viewModel.Data;

                this.radChartView2.Series.Add(series);

                if (!(series is CandlestickSeries))
                {
                    foreach (OhlcPointElement point in series.Children)
                    {
                        if (point.IsFalling)
                        {
                            point.BorderColor = Color.FromArgb(175, 175, 175);
                        }
                    }
                }
            }

            if (this.radDropDownList2.SelectedItem != null)
            {
                IndicatorBase indicator = CreateMAIndicator(this.radDropDownList2.SelectedItem.Text);
                indicator.BorderColor = Color.Red;
                indicator.PointSize   = SizeF.Empty;

                IParentIndicator parentIndicator = indicator as IParentIndicator;
                if (parentIndicator != null)
                {
                    parentIndicator.ChildIndicator.BorderColor = Color.Black;
                }

                this.radChartView2.Series.Add(indicator);
            }
        }