예제 #1
0
        public void PopulateLegend()
        {
            legendItems.Clear();

            if (!LegendVisible)
            {
                return;
            }

            foreach (var chart in plotter.Children.OfType <DependencyObject>())
            {
                var legendItemsBuilder = NewLegend.GetLegendItemsBuilder(chart);
                if (legendItemsBuilder != null)
                {
                    foreach (var legendItem in legendItemsBuilder((IPlotterElement)chart))
                    {
                        legendItems.Add(legendItem);
                    }
                }

                //var controller = LegendItemControllersStore.Current.GetController(chart.GetType());
                //if (controller != null)
                //{
                //    controller.ProcessChart(chart, this);
                //}
            }

            UpdateVisibility();
        }
예제 #2
0
        private static void OnLegendVisibleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            NewLegend owner = (NewLegend)d;

            var visible = (bool)e.NewValue;

            owner.OnLegendVisibleChanged(visible);
        }
예제 #3
0
        private static void OnPlotterChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            NewLegend legend = (NewLegend)d;

            if (e.OldValue != null)
            {
                legend.DetachFromPlotter((Plotter)e.OldValue);
            }
            if (e.NewValue != null)
            {
                legend.AttachToPlotter((Plotter)e.NewValue);
            }
        }
예제 #4
0
        private static void OnShowInLegendChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            NewLegend legend = (NewLegend)d;

            legend.PopulateLegend();
        }