8
Tengo un gráfico y quiero agregar LineSeries dinámicamente sin DataPoints, solo líneas con algunos colores personalizados. La única manera que he encontrado para ocultar los puntos de datos es:wpf toolkit gráfico de líneas sin puntos y con diferentes colores de línea
Style style = new Style(typeof(LineDataPoint));
style.Setters.Add(new Setter(LineDataPoint.TemplateProperty, null));
var series = new LineSeries()
{
Title = name,
DependentValuePath = "Y",
IndependentValuePath = "X",
ItemsSource = new ObservableCollection<FloatingPoint>(),
DataPointStyle = style,
};
Desafortunadamente cuando hago esto todas las líneas se vuelven de color amarillo y no puede cambiar sus colores. he tratado de hacer esto:
Style style = new Style(typeof(LineDataPoint));
style.Setters.Add(new Setter(LineDataPoint.TemplateProperty, null));
SolidColorBrush brush = new SolidColorBrush(Colors.Red);
var series = new LineSeries()
{
Title = name,
DependentValuePath = "Y",
IndependentValuePath = "X",
ItemsSource = new ObservableCollection<FloatingPoint>(),
DataPointStyle = style,
Background = brush,
};
Pero no ayuda - No puedo cambiar el color de línea ... Incluso si escribo
series.Background = brush;
+1 Awesome! ¡Muchas gracias! – Legend
esta debería ser la respuesta aceptada. +1 por ayudarme a resolver el problema. Esto también funciona en XAML. –