private static void OnPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            ChartControl        control = (ChartControl)source;
            AbstractChartDrawer drawer  = (AbstractChartDrawer)e.NewValue;

            control.Update(drawer);
        }
        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();
        }
Exemple #3
0
 public void Update(AbstractChartDrawer drawer)
 {
     XAxisText             = drawer.XAxisText;
     YAxisText             = drawer.YAxisText;
     HorizScrollVisibility = drawer.HorizScrollVisibility;
     VertScrollVisibility  = drawer.VertScrollVisibility;
     LegendVisibility      = drawer.Legend != null && drawer.LegendWidth != 0.0d ? Visibility.Visible : Visibility.Collapsed;
     Background            = drawer.Background;
     LegendWidth           = drawer.LegendWidth;
     legend.Clear();
     if (drawer.Legend != null)
     {
         foreach (var it in drawer.Legend)
         {
             legend.Add(it);
         }
     }
 }
 public void Update(AbstractChartDrawer drawer)
 {
     XAxisText             = drawer.XAxisText;
     YAxisText             = drawer.YAxisText;
     Title                 = drawer.Title;
     HorizScrollVisibility = drawer.HorizScrollVisibility;
     VertScrollVisibility  = drawer.VertScrollVisibility;
     PostionVisibility     = drawer.PostionVisibility;
     LegendVisibility      = drawer.ShowLegendIten && drawer.Legend != null && drawer.Legend.Count != 0 ? Visibility.Visible : Visibility.Collapsed;
     Background            = drawer.Background;
     legend.Clear();
     if (drawer.Legend != null)
     {
         foreach (var it in drawer.Legend)
         {
             legend.Add(it);
         }
     }
 }
        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();
        }