コード例 #1
0
        void InitSymbol(Symbol s, string property, bool isShowMovingAverage = false)
        {
            s.Color = _Colors[IndexMemory % _Colors.Length];
            IndexMemory++;
            HsbColor hsb = ColorEx.RgbToHsb(s.Color);

            s.MovingAverage = new MovingAverage()
            {
                Binding    = property,
                Type       = MovingAverageType.Simple,
                Period     = 10,
                Visibility = isShowMovingAverage ? SeriesVisibility.Visible : SeriesVisibility.Hidden,
            };
            s.MovingAverage.Style.StrokeWidth           = 1;
            s.MovingAverage.Style.FillColor             = s.MovingAverage.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)
            });
            s.MovingAverage.DataSource = s.DataSource;

            s.Series = new C1.Win.Chart.Series()
            {
                Binding = property, Name = s.Code.ToUpper()
            };
            s.Series.ChartType         = ChartType.Line;
            s.Series.Style.StrokeWidth = 2;
            s.Series.Style.FillColor   = Color.FromArgb(64, s.Color);
            s.Series.Style.StrokeColor = s.Color;
            s.Series.DataSource        = s.DataSource;
        }
コード例 #2
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;
        }