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

            var visible = (bool)e.NewValue;

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

            legend.PopulateLegend();
        }