コード例 #1
0
        public void Execute(object parameter)
        {
            C1.Xaml.Chart.C1FlexChart chart = _viewModel.MainChart;

            foreach (var sysmbol in _viewModel.SymbolCollection)
            {
                if (chart.Series.Contains(sysmbol.Series))
                {
                    chart.Series.Remove(sysmbol.Series);
                }
                if (chart.Series.Contains(sysmbol.MovingAverage))
                {
                    chart.Series.Remove(sysmbol.MovingAverage);
                }
            }
            _viewModel.SymbolCollection.Clear();
        }
コード例 #2
0
        private void InitAnnotition(C1.Xaml.Chart.C1FlexChart chart)
        {
            #region Annotations Setup

            AL.PolygonAddFunc = (pt) =>
            {
                return(new C1.Xaml.Chart.Annotation.Polygon("Polygon")
                {
                    Points =
                    {
                        pt, pt, pt
                    }
                });
            };
            chart.Layers.Add(AL);

            AL.PolygonReSizeFunc = (poly, rectangle) =>
            {
                var top   = new Point((float)(rectangle.Left + rectangle.Width / 2), rectangle.Y);
                var left  = new Point(rectangle.Left, rectangle.Bottom);
                var right = new Point(rectangle.Right, rectangle.Bottom);
                poly.Points[0] = EditableAnnotitions.Helpers.CoordsToAnnoPoint(chart, poly, top);
                poly.Points[1] = EditableAnnotitions.Helpers.CoordsToAnnoPoint(chart, poly, left);
                poly.Points[2] = EditableAnnotitions.Helpers.CoordsToAnnoPoint(chart, poly, right);
            };

            AL.ContentEditor = new EditableAnnotitions.AnnotationEditor();
            #endregion

            AL.Attachment = C1.Chart.Annotation.AnnotationAttachment.DataCoordinate;

            ViewModel.ViewModel.Instance.PropertyChanged += (o, e) =>
            {
                if (e.PropertyName == "NewAnnotationType")
                {
                    if (ViewModel.ViewModel.Instance.NewAnnotationType == StockAnalysis.Data.NewAnnotationType.None)
                    {
                        AL.AllowAdd = false;
                    }
                    else
                    {
                        AL.AllowAdd = true;
                        switch (ViewModel.ViewModel.Instance.NewAnnotationType)
                        {
                        case Data.NewAnnotationType.Circle:
                            AL.NewAnnotationType = typeof(C1.Xaml.Chart.Annotation.Circle);
                            break;

                        case Data.NewAnnotationType.Ellipse:
                            AL.NewAnnotationType = typeof(C1.Xaml.Chart.Annotation.Ellipse);
                            break;

                        case Data.NewAnnotationType.Line:
                            AL.NewAnnotationType = typeof(C1.Xaml.Chart.Annotation.Line);
                            break;

                        case Data.NewAnnotationType.Polygon:
                            AL.NewAnnotationType = typeof(C1.Xaml.Chart.Annotation.Polygon);
                            break;

                        case Data.NewAnnotationType.Rectangle:
                            AL.NewAnnotationType = typeof(C1.Xaml.Chart.Annotation.Rectangle);
                            break;

                        case Data.NewAnnotationType.Square:
                            AL.NewAnnotationType = typeof(C1.Xaml.Chart.Annotation.Square);
                            break;

                        case Data.NewAnnotationType.Text:
                            AL.NewAnnotationType = typeof(C1.Xaml.Chart.Annotation.Text);
                            break;

                        case Data.NewAnnotationType.None:
                        default:
                            AL.AllowAdd = false;
                            break;
                        }
                    }
                }
            };
        }