I have the xamDataChart with 6 line series, the default legend is like this:
---- (colored line) Series Title
but I want it to show like this
---- (colored line) Series Title --- (colored line) Series Title -- (colored line) Series Title --- (colored line) Series Title - (colored line) Series Title - (colored line) Series Title
also the colored line is too thin to show the color, if it can be a smal rectangle, it will be better.
Thanks!
Joan
Hello Joan,
Thank you for your post. I have been looking into the appearance that you have described and you can change the order of the items in the Legend you can set the Orientation property of the Legend to Horizontal. By default the line in the LegendItem has the same thickness as the series itself. You can change the thickness by creating a DataTempalte and changing the thickness of the line of the LegendItems. I have created a sample application for you, that demonstrates how you can implement the approaches I have described.
Please let me know if you need any further assistance on the matter.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
Thanks! That's what I want exactly. but how can I get the legend to show the most recent value for the series. like this (the value will update automatically)
Line1 Pressure: 1100.66 psi
Really appreciate you set up an example for everything questions!
Actually I need something like ActualItemBrush in:
<Rectangle Fill="{Binding ActualItemBrush}" Width="20" Height="10" Margin="2" />
I want to be able to bind it like this:
<StackPanel Orientation="Horizontal">
<ContentPresenter Content="{Binding Series.Title}" Margin="0,0,5,0" />
<ContPresenter Content="{Binding Item}" Margin="0,0,10,0" />
StackPanel>
Is there any properties like ActualItemBrush? so I can use to replace the "Item", which is the current value on the chart for specific lineseries. I have a list of data (50) available to plot, so the Item is dynamic. When I am using Item, it's always null, when the list is populated, the Item is never changed to something meaningful. I only add a converter to debug it, so at least Item change is not update the UI.
Thanks,
Thank you for your email. I have been looking into it and the data context of the DataTemplate of the Legend is a DataContext object (http://help.infragistics.com/NetAdvantage/WPF/2012.1/CLR4.0/?page=InfragisticsWPF4.Controls.Charts.XamDataChart.v12.1~Infragistics.Controls.Charts.DataContext_members.html), which is also used as data context for the Markers in the XamDataChart. The Item property of the DataContext object is used when the DataContext object is a data context for a Marker and it returns the data object that corresponds to the data point and the marker. When you are creating a DataTemplate for the LegendItem, the DataContext’s Item property is returning null, since there is no data object that corresponds to the LegendItem. What I can suggest is using the approach I have suggested, adding properties in your ViewModel, that returns the most recent value for the series’ data and bind a TextBlock to that property. In my previous reply, the sample application is using a live data and the most recent value in the LegendItems is changing, based on the data source.
I am just checking if you require any further assistance on the matter.
In the datatrigger below:
<DataTrigger Binding="{Binding Series.Title}" Value="Series 3">
<Setter Property="Visibility" Value="Collapsed" TargetName="recent1"/>
<Setter Property="Visibility" Value="Collapsed" TargetName="recent2"/>
<Setter Property="Visibility" Value="Visible" TargetName="recent3"/>
<DataaTrigger>
In my case, the value of Series.Title is bound to an array and is dynamic. so I set
Value="{Binding Series.DataContext.TrendPens[0].Name}".
shows as invalid xaml.So value doesn't support binding?
I figured this out, the value is not DependencyProperty. So use the name of the series will work.