In addition to vaquita50’s post just now on RolloverModifier, I also want to output the x value (once for all series) in the rollover summary (but I don’t want to hijack that thread).
I also want to apply custom number formatting for each series. So series 0 number format might be “{N:3}”, series 1 might be “{0}g”, etc. Is such an example available or easy enough to produce?
Also, how do I force the box to exist, even when not over a valid x value? In the example, the box almost disappears to an empty (but still there!) border… ???
Thanks.
AC
- BowIT_Andy asked 11 years ago
- You must login to post comments
Hi Andrew,
Already seen the examples, browsed through the definitions, not managed to make it work, hence here! I saw the XValue, but my output-x-value solution is all rather hacky. Not to worry – it works at least.
And in case anyone else needs to know, after much hacking around I came up with this to display something if there is no data…
<ItemsControl.Style>
<Style TargetType="{x:Type ItemsControl}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=RolloverData.SeriesInfo,Converter={StaticResource EmptyCollectionConverter}}" Value="True">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ItemsControl}">
<TextBlock Text="No data selected" Margin="5,0" HorizontalAlignment="Center" />
</ControlTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</ItemsControl.Style>
public class EmptyCollectionConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var collection = value as ICollection;
if (collection == null)
{
return null;
}
return collection.Count == 0;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
Hope it helps someone!
- BowIT_Andy answered 11 years ago
- You must login to post comments
Hi Andy,
The RolloverModifier samples demonstrate that the RolloverModifier is simply a data-source, which gives you an ObservableCollection<SeriesInfo> to bind to.
There is a long explanation in the answer RolloverLabelTemplate show X and Y Value Separated which shows how to get the X Value in the Rollover legend output, and how to apply a custom string format to the X or Y Value.
Hope this helps,
Andrew
- Andrew Burnett-Thompson answered 11 years ago
- You must login to post comments
Please login first to submit.