Exemplo n.º 1
0
        public ScrollBarArea(OxyAreaSettings settings, List <OxyArea> all_areas, OxyChartPainter owner) : base(settings, owner)
        {
            area_settings  = settings;
            this.all_areas = all_areas;

            plot_view.DefaultTrackerTemplate = new System.Windows.Controls.ControlTemplate();



            screen_viewer_polygon = new PolygonAnnotation()
            {
                Layer             = AnnotationLayer.AboveSeries,
                Selectable        = true,
                Fill              = area_settings.ScrollBarColor,
                EdgeRenderingMode = EdgeRenderingMode.PreferSpeed,
                Tag = "screen_viewer_polygon",
            };

            screen_viewer_polygon.Points.AddRange(new List <OxyPlot.DataPoint>()
            {
                new OxyPlot.DataPoint(0, 0),
                new OxyPlot.DataPoint(0, 0),
                new OxyPlot.DataPoint(0, 0),
                new OxyPlot.DataPoint(0, 0),
            });


            plot_model.MouseDown  += Plot_model_scroll_chart_MouseDown;
            plot_model.MouseUp    += Plot_model_scroll_chart_MouseUp;
            plot_model.MouseLeave += Plot_model_scroll_chart_MouseLeave;
            plot_model.MouseMove  += Plot_model_scroll_chart_MouseMove;

            plot_model.Updated += Plot_model_Updated;
        }
Exemplo n.º 2
0
        public IndicatorArea(OxyAreaSettings settings, List <OxyArea> all_areas, object tag, OxyChartPainter owner) : base(settings, owner)
        {
            area_settings  = settings;
            this.all_areas = all_areas;
            Tag            = tag;

            date_time_axis_X.IsAxisVisible = area_settings.X_Axies_is_visible;
            date_time_axis_X.IsPanEnabled  = false;

            linear_axis_Y.IsAxisVisible = area_settings.Y_Axies_is_visible;
            linear_axis_Y.IsPanEnabled  = false;

            handy_bar_series = new LinearBarSeries()
            {
                FillColor  = OxyColor.FromArgb(160, 65, 157, 238),
                BarWidth   = 5,
                Selectable = false,
                Tag        = "SeriaNameBar"
            };

            handy_lines_series = new LineSeries()
            {
                Color = OxyColor.Parse("#FF33FF"),
                Tag   = "SeriaNameBar"
            };

            handy_scatter_series = new ScatterSeries()
            {
                MarkerFill        = OxyColors.Yellow,
                MarkerStroke      = OxyColors.Yellow,
                MarkerSize        = 1,
                MarkerType        = MarkerType.Circle,
                Selectable        = false,
                EdgeRenderingMode = EdgeRenderingMode.Adaptive,
                Tag = "SeriaScatter"
            };

            plot_model.Updated += Plot_model_Updated;
        }
Exemplo n.º 3
0
        public OxyArea(OxyAreaSettings settings, OxyChartPainter owner)
        {
            this.chart_name = owner.chart_name;

            area_settings = settings;
            Tag           = area_settings.Tag;
            this.owner    = owner;

            candles_in_run = area_settings.candles_in_run;
            empty_gap      = area_settings.empty_gap;

            plot_model = new PlotModel()
            {
                PlotAreaBorderThickness = new OxyThickness(0),
                TextColor         = OxyColors.AliceBlue,
                EdgeRenderingMode = EdgeRenderingMode.PreferSpeed
            };

            plot_view = new PlotView()
            {
                Background = area_settings.Brush_background,
            };

            drawed_name = new CustomTextAnnotation()
            {
                Text       = (string)Tag,
                TextColor  = OxyColor.FromArgb(255, 98, 103, 113),
                Background = OxyColors.Transparent,
                Stroke     = OxyColors.Transparent,
                Tag        = "drawed_name",
                Layer      = OxyPlot.Annotations.AnnotationLayer.AboveSeries,
                TextHorizontalAlignment = HorizontalAlignment.Left,
                TextVerticalAlignment   = VerticalAlignment.Middle,
                FontSize = 24,
            };

            annotation_price = new CustomTextAnnotation()
            {
                Layer                   = AnnotationLayer.AboveSeries,
                ClipByXAxis             = false,
                ClipByYAxis             = false,
                Background              = OxyColor.Parse("#FF5500"),
                TextColor               = OxyColors.AliceBlue,
                Stroke                  = OxyColor.Parse("#FF5500"),
                TextHorizontalAlignment = HorizontalAlignment.Right,
                TextVerticalAlignment   = VerticalAlignment.Middle,
                Padding                 = new OxyThickness(2),
                EdgeRenderingMode       = EdgeRenderingMode.PreferSpeed,
                Tag = "annotation_price"
            };


            annotation_date_time = new CustomTextAnnotation()
            {
                Layer                   = AnnotationLayer.AboveSeries,
                ClipByXAxis             = false,
                ClipByYAxis             = true,
                Background              = OxyColor.Parse("#FF5500"),
                TextColor               = OxyColors.AliceBlue,
                Stroke                  = OxyColor.Parse("#FF5500"),
                TextHorizontalAlignment = HorizontalAlignment.Center,
                TextVerticalAlignment   = VerticalAlignment.Bottom,
                Padding                 = new OxyThickness(2),
                EdgeRenderingMode       = EdgeRenderingMode.PreferSpeed,
                Tag = "annotation_date_time"
            };

            linear_axis_X_top = new LinearAxis()
            {
                TicklineColor          = area_settings.TicklineColor,
                AxislineStyle          = area_settings.AxislineStyle,
                AxislineThickness      = 1,
                AxislineColor          = area_settings.AxislineColor,
                MajorGridlineColor     = area_settings.MajorGridlineColor,
                MajorGridlineStyle     = area_settings.MajorGridlineStyle,
                MajorGridlineThickness = area_settings.MajorGridlineThickness,
                MinorGridlineColor     = area_settings.MinorGridlineColor,
                MinorGridlineStyle     = area_settings.MinorGridlineStyle,
                MinorGridlineThickness = area_settings.MinorGridlineThickness,
                Key               = "TopX",
                IsAxisVisible     = false,
                Position          = AxisPosition.Top,
                Layer             = AxisLayer.BelowSeries,
                EdgeRenderingMode = area_settings.EdgeRenderingMode,
            };

            //date_time_axis_X = new DateTimeAxis()
            string dateFormat = "HH:mm";

            date_time_axis_X = new FinancialChartAxis(dateFormat)
            {
                TicklineColor          = area_settings.TicklineColor,
                AxislineStyle          = area_settings.AxislineStyle,
                AxislineThickness      = 1,
                AxislineColor          = area_settings.AxislineColor,
                MajorGridlineColor     = area_settings.MajorGridlineColor,
                MajorGridlineStyle     = area_settings.MajorGridlineStyle,
                MajorGridlineThickness = area_settings.MajorGridlineThickness,
                MinorGridlineColor     = area_settings.MinorGridlineColor,
                MinorGridlineStyle     = area_settings.MinorGridlineStyle,
                MinorGridlineThickness = area_settings.MinorGridlineThickness,
                Key               = "DateTime",
                IsAxisVisible     = false,
                Position          = AxisPosition.Bottom,
                EdgeRenderingMode = area_settings.EdgeRenderingMode,
            };


            linear_axis_Y = new LinearAxis()
            {
                TicklineColor          = area_settings.TicklineColor,
                AxislineStyle          = area_settings.AxislineStyle,
                AxislineThickness      = 1,
                AxislineColor          = area_settings.AxislineColor,
                MajorGridlineColor     = area_settings.MajorGridlineColor,
                MajorGridlineStyle     = area_settings.MajorGridlineStyle,
                MajorGridlineThickness = area_settings.MajorGridlineThickness,
                MinorGridlineColor     = area_settings.MinorGridlineColor,
                MinorGridlineStyle     = area_settings.MinorGridlineStyle,
                MinorGridlineThickness = area_settings.MinorGridlineThickness,
                IsAxisVisible          = false,
                Key               = "PrimeY",
                Layer             = AxisLayer.BelowSeries,
                Position          = AxisPosition.Right,
                EdgeRenderingMode = area_settings.EdgeRenderingMode,
            };


            if (settings.cursor_Y_is_active)
            {
                cursor_Y = new LineAnnotation()
                {
                    Type              = LineAnnotationType.Vertical,
                    Color             = area_settings.CursorColor,
                    Selectable        = false,
                    ClipByYAxis       = false,
                    X                 = double.MinValue,
                    StrokeThickness   = 0.5,
                    Layer             = AnnotationLayer.BelowSeries,
                    EdgeRenderingMode = EdgeRenderingMode.Automatic,
                    LineStyle         = LineStyle.LongDash
                };
            }

            if (settings.cursor_X_is_active)
            {
                cursor_X = new LineAnnotation()
                {
                    Type              = LineAnnotationType.Horizontal,
                    Color             = area_settings.CursorColor,
                    ClipByXAxis       = false,
                    Selectable        = false,
                    Y                 = double.MinValue,
                    StrokeThickness   = 0.5,
                    Layer             = AnnotationLayer.BelowSeries,
                    EdgeRenderingMode = EdgeRenderingMode.Automatic,
                    LineStyle         = LineStyle.LongDash
                };
            }

            if (settings.rectangle_range_is_active)
            {
                range = new RectangleAnnotation()
                {
                    Fill     = OxyColor.FromArgb(80, 128, 222, 234),
                    MinimumX = 0,
                    MaximumX = 0,
                    TextVerticalAlignment = VerticalAlignment.Top,
                };

                plot_model.Annotations.Add(range);
            }


            if (area_settings.ann_order_is_active)
            {
                lineFairPrice = new LineAnnotation()
                {
                    Type              = LineAnnotationType.Horizontal,
                    Color             = OxyColor.Parse("#f8edeb"),
                    ClipByXAxis       = false,
                    Selectable        = false,
                    Y                 = double.MinValue,
                    StrokeThickness   = 1,
                    Layer             = AnnotationLayer.BelowSeries,
                    EdgeRenderingMode = EdgeRenderingMode.Automatic,
                    LineStyle         = LineStyle.LongDash
                };

                lineStopLoss = new LineAnnotation()
                {
                    Type              = LineAnnotationType.Horizontal,
                    ClipByXAxis       = false,
                    Selectable        = false,
                    Y                 = double.MinValue,
                    StrokeThickness   = 1,
                    Layer             = AnnotationLayer.BelowSeries,
                    EdgeRenderingMode = EdgeRenderingMode.Automatic,
                };

                lineStopLossPartial = new LineAnnotation()
                {
                    Type              = LineAnnotationType.Horizontal,
                    ClipByXAxis       = false,
                    Selectable        = false,
                    Y                 = double.MinValue,
                    StrokeThickness   = 1,
                    Layer             = AnnotationLayer.BelowSeries,
                    EdgeRenderingMode = EdgeRenderingMode.Automatic,
                };

                lineCloseOrder = new LineAnnotation()
                {
                    Type              = LineAnnotationType.Horizontal,
                    ClipByXAxis       = false,
                    Selectable        = false,
                    Y                 = double.MinValue,
                    StrokeThickness   = 1,
                    Layer             = AnnotationLayer.BelowSeries,
                    EdgeRenderingMode = EdgeRenderingMode.Automatic,
                };

                lineActiveOrder = new LineAnnotation()
                {
                    Type              = LineAnnotationType.Horizontal,
                    ClipByXAxis       = false,
                    Selectable        = false,
                    Y                 = double.MinValue,
                    StrokeThickness   = 1,
                    Layer             = AnnotationLayer.BelowSeries,
                    EdgeRenderingMode = EdgeRenderingMode.Automatic,
                };

                plot_model.Annotations.Add(lineFairPrice);
                plot_model.Annotations.Add(lineStopLossPartial);
                plot_model.Annotations.Add(lineStopLoss);
                plot_model.Annotations.Add(lineCloseOrder);
                plot_model.Annotations.Add(lineActiveOrder);
            }

            plot_model.Annotations.Add(annotation_price);
            plot_model.Annotations.Add(annotation_date_time);


            plot_model.Axes.Add(date_time_axis_X);
            plot_model.Axes.Add(linear_axis_Y);
            plot_model.Axes.Add(linear_axis_X_top);

            if (area_settings.cursor_X_is_active)
            {
                plot_model.Annotations.Add(cursor_X);
            }

            if (area_settings.cursor_Y_is_active)
            {
                plot_model.Annotations.Add(cursor_Y);
            }

            plot_view.Model = plot_model;
        }
Exemplo n.º 4
0
        public ControlPanelArea(OxyAreaSettings settings, List <OxyArea> all_areas, OxyChartPainter owner) : base(settings, owner)
        {
            area_settings  = settings;
            this.all_areas = all_areas;

            menu_button = new CustomTextAnnotation()
            {
                Background              = OxyColors.Transparent,
                Stroke                  = OxyColor.Parse("#FF5500"),
                StrokeThickness         = 1,
                Text                    = "MENU",
                TextVerticalAlignment   = VerticalAlignment.Bottom,
                TextHorizontalAlignment = HorizontalAlignment.Left,
                Layer                   = AnnotationLayer.AboveSeries,
                Padding                 = new OxyThickness(3, 0, 3, 1),
            };


            if (owner.start_program == StartProgram.IsTester)
            {
                speed_lable = new CustomTextAnnotation()
                {
                    Background              = OxyColors.Transparent,
                    Stroke                  = OxyColors.Transparent,
                    StrokeThickness         = 0,
                    Text                    = "Speed: ",
                    TextPosition            = new ScreenPoint(20, 12),
                    TextVerticalAlignment   = VerticalAlignment.Bottom,
                    TextHorizontalAlignment = HorizontalAlignment.Left,
                    Layer                   = AnnotationLayer.AboveSeries,
                };

                minus_button = new CustomTextAnnotation()
                {
                    Background              = OxyColors.Transparent,
                    Stroke                  = OxyColor.Parse("#FF5500"),
                    StrokeThickness         = 1,
                    Text                    = "-",
                    TextPosition            = new ScreenPoint(65, 12),
                    TextVerticalAlignment   = VerticalAlignment.Bottom,
                    TextHorizontalAlignment = HorizontalAlignment.Left,
                    Layer                   = AnnotationLayer.AboveSeries,
                    Padding                 = new OxyThickness(4.5, -1, 4.5, 1),
                };

                plus_button = new CustomTextAnnotation()
                {
                    Background              = OxyColors.Transparent,
                    Stroke                  = OxyColor.Parse("#FF5500"),
                    StrokeThickness         = 1,
                    Text                    = "+",
                    TextPosition            = new ScreenPoint(80, 12),
                    TextVerticalAlignment   = VerticalAlignment.Bottom,
                    TextHorizontalAlignment = HorizontalAlignment.Left,
                    Layer                   = AnnotationLayer.AboveSeries,
                    Padding                 = new OxyThickness(3, -1, 2.5, 1),
                };

                speed_state_lable = new CustomTextAnnotation()
                {
                    Background              = OxyColors.Transparent,
                    Stroke                  = OxyColors.Transparent,
                    StrokeThickness         = 0,
                    Text                    = "x1",
                    TextPosition            = new ScreenPoint(100, 12),
                    TextVerticalAlignment   = VerticalAlignment.Bottom,
                    TextHorizontalAlignment = HorizontalAlignment.Left,
                    Layer                   = AnnotationLayer.AboveSeries,
                };
            }

            plot_model.Annotations.Add(menu_button);


            if (owner.start_program == StartProgram.IsTester)
            {
                plot_model.Annotations.Add(speed_lable);
                plot_model.Annotations.Add(minus_button);
                plot_model.Annotations.Add(plus_button);
                plot_model.Annotations.Add(speed_state_lable);

                minus_button.MouseDown += Minus_button_MouseDown;
                minus_button.MouseUp   += Minus_button_MouseUp;

                plus_button.MouseDown += Plus_button_MouseDown;
                plus_button.MouseUp   += Plus_button_MouseUp;
            }

            menu_button.MouseDown += Menu_button_MouseDown;
            menu_button.MouseUp   += Menu_button_MouseUp;

            plot_model.Updated   += Plot_model_Updated;
            plot_model.MouseDown += Plot_model_MouseDown;
        }