private static void OnPaletteModeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (e.OldValue.Equals(e.NewValue)) { return; } PointSeries series = d as PointSeries; series.paletteModeCache = (SeriesPaletteMode)e.NewValue; if (series.paletteModeCache == SeriesPaletteMode.Series) { foreach (var item in series.legendItems) { series.Chart.LegendInfosInternal.Remove(item.Value); } series.legendItems = null; } else { series.legendItems = new Dictionary <DataPoint, LegendItem>(); } series.InvalidatePalette(); }
private static void OnPointSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { PointSeries presenter = d as PointSeries; presenter.defaultVisualSizeCache.Width = presenter.PointSize.Width; presenter.defaultVisualSizeCache.Height = presenter.PointSize.Height; presenter.realizedDataPointPresenters.Clear(); if (presenter.renderSurface != null) { presenter.renderSurface.Children.Clear(); } foreach (var dataPoint in presenter.DataPoints) { dataPoint.desiredSize = RadSize.Invalid; } presenter.InvalidateCore(); }
internal override void UpdateLegendItem(FrameworkElement visual, DataPoint dataPoint) { if (visual != null && this.IsVisibleInLegend) { LegendItem item; bool titleUpdateNeeded = false; if (this.paletteModeCache == SeriesPaletteMode.DataPoint) { if (!this.legendItems.TryGetValue(dataPoint, out item)) { item = new LegendItem(); titleUpdateNeeded = true; this.legendItems.Add(dataPoint, item); // TODO refactor this. this.Chart.LegendInfosInternal.Add(item); } PointSeries.UpdateLegendItemProperties(item, (Brush)visual.GetValue(Path.FillProperty), (Brush)visual.GetValue(Path.StrokeProperty)); } else { item = this.LegendItems.FirstOrDefault(); this.UpdateLegendItemProperties((Brush)visual.GetValue(Path.FillProperty), (Brush)visual.GetValue(Path.StrokeProperty)); } if (item != null && titleUpdateNeeded) { if (this.LegendTitleBinding != null) { this.UpdateLegendTitle(dataPoint, item); } else if (this.LegendTitle != null) { item.Title = this.LegendTitle; } } } }