Example #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();
        }
Example #2
0
        private static void OnLegendVisibleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            NewLegend owner = (NewLegend)d;

            var visible = (bool)e.NewValue;

            owner.OnLegendVisibleChanged(visible);
        }
Example #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);
            }
        }
Example #4
0
        private static void OnShowInLegendChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            NewLegend legend = (NewLegend)d;

            legend.PopulateLegend();
        }