Example #1
0
        private void InitializeTopChart()
        {
            if (_quoteData == null || !_quoteData.Any())
            {
                return;
            }

            var maxVolume = _quoteData.Max(p => p.Volume);

            HsbColor hsb = ColorEx.RgbToHsb(_baseSeriesColor);

            financialChart1.BeginUpdate();
            financialChart1.BindingX        = "Date";
            financialChart1.ToolTip.Active  = false;
            financialChart1.AxisY.Position  = Position.Right;
            financialChart1.AxisY.MajorGrid = false;
            financialChart1.AxisY.MinorGrid = false;
            financialChart1.AxisY.Format    = null;
            financialChart1.Legend.Position = Position.None;

            ma = new MovingAverage()
            {
                Binding    = Binding,
                Type       = C1.Chart.MovingAverageType.Simple,
                Period     = 10,
                Visibility = SeriesVisibility.Hidden
            };
            ma.Style.StrokeWidth           = 1;
            ma.Style.FillColor             = ma.Style.StrokeColor
                                           = ColorEx.HsbToRgb(new HsbColor()
            {
                A = hsb.A, H = hsb.H, S = Math.Max(hsb.B / 2, 0), B = Math.Min(hsb.B * 2, 1)
            });
            financialChart1.Series.Add(ma);

            fs = new Series()
            {
                Binding = Binding, Name = Symbol.ToUpper()
            };
            fs.ChartType         = ChartType.Line;
            fs.Style.StrokeWidth = 2;
            fs.Style.FillColor   = Color.FromArgb(64, _baseSeriesColor);
            fs.Style.StrokeColor = _baseSeriesColor;
            financialChart1.Series.Add(fs);

            vs = new Series()
            {
                Binding = "Volume", AxisY = new C1.Win.Chart.Axis()
                {
                    Max = maxVolume * 8
                }, ChartType = C1.Chart.ChartType.Column
            };
            vs.Style.FillColor   = Color.FromArgb(255, 165, 0);
            vs.Style.StrokeColor = Color.FromArgb(255, 165, 0);
            financialChart1.Series.Add(vs);

            financialChart1.ChartType  = FinancialChartType.Line;
            financialChart1.DataSource = _quoteData;
            financialChart1.EndUpdate();
            financialChart1.MouseMove += FinancialChart1_MouseMove;
        }