Esempio n. 1
0
 private LegendItem RaiseResolveLegendItem(LegendItem uncustomizedLegendItem)
 {
     if (ResolveLegendItem != null)
     {
         ResolveLegendItemEventArgs e = new ResolveLegendItemEventArgs(uncustomizedLegendItem);
         ResolveLegendItem(this, e);
         return(e.LegendItem);
     }
     else
     {
         return(uncustomizedLegendItem);
     }
 }
Esempio n. 2
0
        private void graph_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "Description")
            {
                ViewportElement2D graph         = (ViewportElement2D)sender;
                LegendItem        oldLegendItem = cachedLegendItems[graph];
                int index = stackPanel.Children.IndexOf(oldLegendItem);
                stackPanel.Children.RemoveAt(index);

                LegendItem newLegendItem = graph.Description.LegendItem;
                cachedLegendItems[graph] = newLegendItem;
                stackPanel.Children.Insert(index, newLegendItem);
            }
        }
Esempio n. 3
0
        public void PopulateLegend()
        {
            stackPanel.Children.Clear();

            if (plotter == null)
            {
                return;
            }

            cachedLegendItems.Clear();
            foreach (var graph in plotter.Children.OfType <ViewportElement2D>())
            {
                if (GetVisibleInLegend(graph))
                {
                    LegendItem legendItem = graph.Description.LegendItem;
                    cachedLegendItems.Add(graph, legendItem);
                    AddLegendItem(legendItem);
                }
            }

            UpdateVisibility();
        }
Esempio n. 4
0
 /// <summary>
 /// Removes the legend item.
 /// </summary>
 /// <param name="legendItem">The legend item.</param>
 public void RemoveLegendItem(LegendItem legendItem)
 {
     stackPanel.Children.Remove(legendItem);
     UpdateVisibility();
 }
Esempio n. 5
0
 /// <summary>
 /// Adds new legend item.
 /// </summary>
 /// <param name="legendItem">The legend item.</param>
 public void AddLegendItem(LegendItem legendItem)
 {
     stackPanel.Children.Add(legendItem);
     UpdateVisibility();
 }
Esempio n. 6
0
 public ResolveLegendItemEventArgs(LegendItem legendItem)
 {
     LegendItem = legendItem;
 }
Esempio n. 7
0
        private LegendItem CreateLegendItem()
        {
            LegendItem item = CreateLegendItemCore();

            return(RaiseResolveLegendItem(item));
        }