Пример #1
0
        void InitSymbol(Symbol s, string property)
        {
            s.Color = ChartViewModel._Colors[IndexMemory % ChartViewModel._Colors.Length];
            IndexMemory++;
            HsbColor hsb = ColorEx.RgbToHsb(s.Color);

            s.MovingAverage = new C1.Xaml.Chart.Finance.MovingAverage()
            {
                Binding = property,
                Type    = MovingAverageType.Simple,
                Period  = 10,
            };

            s.MovingAverage.Visibility             = _viewModel.IsShowMovingAverage ? SeriesVisibility.Visible : SeriesVisibility.Hidden;
            s.MovingAverage.Style                  = new ChartStyle();
            s.MovingAverage.Style.Fill             = s.MovingAverage.Style.Stroke
                                                   = new SolidColorBrush(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.ItemsSource = s.DataSource;

            s.Series = new Series()
            {
                Binding = property, SeriesName = s.Code.ToUpper()
            };
            s.Series.ChartType             = ChartType.Line;
            s.Series.Style                 = new ChartStyle();
            s.Series.Style.StrokeThickness = 2;
            s.Series.Style.Fill            = new SolidColorBrush(Windows.UI.Color.FromArgb(64, s.Color.R, s.Color.G, s.Color.B));
            s.Series.Style.Stroke          = new SolidColorBrush(s.Color);
            s.Series.ItemsSource           = s.DataSource;
        }