Пример #1
0
        private void Update(AbstractChartDrawer drawer)
        {
            if (drawer == null)
            {
                return;
            }

            if (drawer.Settings == null)
            {
                drawer.Settings = new WPFCanvasChartSettings(); //default settings
            }

            if (drawer.XAxisInterpolator == null)
            {
                drawer.XAxisInterpolator = new WPFCanvasChartIntInterpolator();
            }

            if (drawer.YAxisInterpolator == null)
            {
                drawer.YAxisInterpolator = new WPFCanvasChartFloatInterpolator();
            }

            if (drawer.Chart == null)
            {
                drawer.Chart = new WPFCanvasChartComponent();
            }

            drawer.Chart.Dispose();
            drawer.Chart.Init(Canvas,
                              drawer.HorizScrollVisibility == System.Windows.Visibility.Visible ? HorizScroll : null,
                              drawer.VertScrollVisibility == System.Windows.Visibility.Visible ? VertScroll : null,
                              drawer,
                              drawer.Settings,
                              drawer.XAxisInterpolator,
                              drawer.YAxisInterpolator);

            Drawer.MouseOverCallBack = (x, y) =>
            {
                if (viewModel.PostionVisibility == Visibility.Visible)
                {
                    viewModel.PosX = "X: " + string.Format("{0:0.00;- 0.00;0}", x);
                    viewModel.PosY = "Y: " + string.Format("{0:0.00;- 0.00;0}", y);
                }
            };


            viewModel.Update(drawer);
            drawer.Update();
        }
        private void Update(AbstractChartDrawer drawer)
        {
            if (drawer == null)
            {
                return;
            }

            if (drawer.Settings == null)
            {
                drawer.Settings = new WPFCanvasChartSettings(); //default settings
            }

            if (drawer.XAxisInterpolator == null)
            {
                drawer.XAxisInterpolator = new WPFCanvasChartIntInterpolator();
            }

            if (drawer.YAxisInterpolator == null)
            {
                drawer.YAxisInterpolator = new WPFCanvasChartFloatInterpolator();
            }

            if (drawer.Chart == null)
            {
                drawer.Chart = new WPFCanvasChartComponent();
            }

            drawer.Chart.Dispose();
            drawer.Chart.Init(Canvas,
                              drawer,
                              drawer.Settings,
                              drawer.XAxisInterpolator,
                              drawer.YAxisInterpolator);

            viewModel.Update(drawer);
            drawer.Update();
        }