Hi,
my project is based on the examples from this thread:
http://es.infragistics.com/community/forums/t/97638.aspx
How can I add legend entries only for e.g. every other series in the chart?
Best
Oliver
Hi Oliver,
Each series has a LegendItemVisibility property. It's just a matter of hooking up this property to the view model like the series binder does with a number of other series properties. I added a property for legend visibility so now you can tell it what property in your view model you want to use for controlling whether it is visible in the legend or not and the series binder will bind the Series.LegendItemVisibility to it.
Thanks.
Thanks!
Is there a possibility to give e.g. 2 of the series the same color?
Hi Florian,
I'm a bit late to your response but if this is still an active question... the series has a property called Thickness which is responsible for controlling the thickness of the line.http://help.infragistics.com/doc/WPF/2016.1/CLR4.0/?page=InfragisticsWPF4.Controls.Charts.XamDataChart.v16.1~Infragistics.Controls.Charts.Series~Thickness.html
@Oliver, there should be a MarkerBrush property that you can bind to which will update the color of the markers.http://help.infragistics.com/doc/WPF/2016.1/CLR4.0/?page=InfragisticsWPF4.Controls.Charts.XamDataChart.v16.1~Infragistics.Controls.Charts.MarkerSeries~MarkerBrush.html
Hello,
concerning the example given in the starting post, I have a question too: is ist possible to set the thickness of the lines in the XamDataChart? If yes, how and where do I have to set this property?
Forget what I wrote, It works just fine.
The issue is that only the lines have the chosen color but not the markers.
How can I bind the markercolor the my property as well?
Hi Rob,
I added a new property:
private const string BrushPathPropertyName = "BrushPath";
public string BrushPath { get { return (string)GetValue(BrushPathProperty); } set { SetValue(BrushPathProperty, value); } }
public static readonly DependencyProperty BrushPathProperty = DependencyProperty.Register(BrushPathPropertyName,typeof(string),typeof(SeriesBinderInfo),new PropertyMetadata(string.Empty));
And modified the UpdateSeriesProperties method:
if (!string.IsNullOrEmpty(BrushPath)) series.SetBinding(Series.BrushProperty, new Binding(BrushPath) { Source = seriesSource });
and add case BrushPathPropertyName: to OnPropertyChanged.
Furthermore, I added a nhew property to my SeriesViewModel:
private Brush _seriesColor; public Brush SeriesColor { get { return _seriesColor; } set { if (Equals(value, _seriesColor)) return; _seriesColor = value; RaisePropertyChanged(() => SeriesColor); } }
and I set the property in xaml but it does not do anything.
Would you mind extending the example so that i can set the color of the lines in the chart in the viewmodel?
Definitely. The Series has a Brush property which you can set to control what the color for that series is. I don't believe the SeriesBinder sample sets this so it uses default coloring which is why they all have different colors. If you want to set the color of the series from the view model you can add another dependency property to the SeriesBinderInfo class that will point the series binder to the view model property responsible for the color. It will work the same way the IsVisibleMemberPath and LegendVisibilityMemberPath currently work which I added in my previous samples. Once that property is added, go to UpdateSeriesProperties and at the bottom add similar code as to what I added down there for the IsVisible and LegendVisibility properties.
Then go to OnPropertyChanged and add the new property name to the switch statement, the same way as the IsVisible and LegendVisibility property names. Once this is added you are just about done. Now just add a property to the SeriesViewModel class that will control the color of that series and then in XAML set the new property in the SeriesBinderInfo.