void IChartLegend <SkiaSharpDrawingContext> .Draw(Chart <SkiaSharpDrawingContext> chart) { var series = chart.DrawableSeries; var legendOrientation = chart.LegendOrientation; var legendPosition = chart.LegendPosition; Series = series; switch (legendPosition) { case LegendPosition.Hidden: Visibility = Visibility.Collapsed; break; case LegendPosition.Top: Visibility = Visibility.Visible; if (legendOrientation == LegendOrientation.Auto) { Orientation = Orientation.Horizontal; } Dock = Dock.Top; break; case LegendPosition.Left: Visibility = Visibility.Visible; if (legendOrientation == LegendOrientation.Auto) { Orientation = Orientation.Vertical; } Dock = Dock.Left; break; case LegendPosition.Right: Visibility = Visibility.Visible; if (legendOrientation == LegendOrientation.Auto) { Orientation = Orientation.Vertical; } Dock = Dock.Right; break; case LegendPosition.Bottom: Visibility = Visibility.Visible; if (legendOrientation == LegendOrientation.Auto) { Orientation = Orientation.Horizontal; } Dock = Dock.Bottom; break; default: break; } if (legendOrientation != LegendOrientation.Auto) { Orientation = legendOrientation == LegendOrientation.Horizontal ? Orientation.Horizontal : Orientation.Vertical; } var wpfChart = (Chart)chart.View; FontFamily = wpfChart.LegendFontFamily ?? new FontFamily("Trebuchet MS"); TextColor = wpfChart.LegendTextColor ?? new SolidColorBrush(Color.FromRgb(35, 35, 35)); FontSize = wpfChart.LegendFontSize ?? 13; FontWeight = wpfChart.LegendFontWeight ?? FontWeights.Normal; FontStyle = wpfChart.LegendFontStyle ?? FontStyles.Normal; FontStretch = wpfChart.LegendFontStretch ?? FontStretches.Normal; UpdateLayout(); }