Hello,
Is there an easy why to show always the last value from the series in the legend?
Hello Bin,
Thank you for posting to Infragistics Community!
I have been looking into your question and created a small sample with a XamDataChart with ColumnSeries demonstrating how your requirement about only showing the last item’s value in the legend can be achieved.
A custom LegendItemTemplate DataTemplate can be created for the target series. For the purposes of the example, the template is really simple, however it can be styled as per your taste. The TextBlock within it is bound to the corresponding Series’ ItemsSource. With the help of a converter, returning the last item of a collection, the last object’s target property value is accessed and a custom string is returned from the Convert method. This is what is finally shown in the legend. This is simply one approach to how this can be achieved, for example you could keep the last item of the collection in your view model or local data, so that the binding does not use a converter.
Please, test the below attached sample on your side and if you require any further assistance on the matter, please let me know.
Sincerely,Bozhidara PachilovaAssociate Software Developer
2308.XDCLegendLastSeriesItem.zip
Thanks for the solution. This works perfectly.
I also want to update the last item value in the legend when a new Item is added. I am using a ObservableCollectionExtended datasource. In my scenary, my chart is refrehsed every minute with the current data.
What is the easiest way to trigger a refresh of the legend item?