示例#1
0
        protected override void OnElementChanged(ElementChangedEventArgs <SciChart.Xamarin.Views.Visuals.SciChartSurface> e)
        {
            base.OnElementChanged(e);

            if (Control == null)
            {
                // Create the native control
                SciChartSurface surface = new SciChartSurface();

                // Enable the zoom
                using (surface.SuspendUpdates())
                {
                    surface.ChartModifier = new ModifierGroup(new ZoomPanModifier(),
                                                              new MouseWheelZoomModifier());
                }

                this.SetNativeControl(surface);

                // Setup property mapper
                _propertyMapper = new SciChartSurfaceWpfPropertyMapper(e.NewElement, Control);
            }
        }
示例#2
0
        private void InitChart(SciChartSurface surface, BasePaneModel model, bool isMainPain)
        {
            var xAxis = new CategoryDateAxis(Activity)
            {
                Visibility = (int)(isMainPain ? ViewStates.Visible : ViewStates.Gone), GrowBy = new DoubleRange(0, 0.05)
            };

            using (surface.SuspendUpdates())
            {
                surface.XAxes.Add(xAxis);
                surface.YAxes.Add(model.YAxis);
                surface.RenderableSeries = model.RenderableSeries;
                surface.Annotations      = model.Annotations;

                surface.ChartModifiers = new ChartModifierCollection
                {
                    new ModifierGroup
                    {
                        MotionEventGroup = "ModifiersSharedEventsGroup",
                        ChildModifiers   = new ChartModifierCollection
                        {
                            new XAxisDragModifier {
                                DragMode = AxisDragModifierBase.AxisDragMode.Pan, ClipModeX = ClipMode.StretchAtExtents
                            }.WithReceiveHandledEvents(true),
                            new PinchZoomModifier {
                                Direction = Direction2D.XDirection
                            }.WithReceiveHandledEvents(true),
                            new ZoomPanModifier().WithReceiveHandledEvents(true),
                            new ZoomExtentsModifier().WithReceiveHandledEvents(true),
                            new LegendModifier(Activity).WithShowCheckBoxes(false),
                        }
                    }.WithReceiveHandledEvents(true)
                };
            }
            _verticalGroup.AddSurfaceToGroup(surface);
        }