rudi Posted November 25, 2008 Report Share Posted November 25, 2008 Hi, I'm using a CrosstabTranformation in order to obtain the results I want in a Pie chart. What's currently being displayed is a numerical value, and I would like to use a converter in order to show the textual description of that value in the Legend. <ChartFX:Chart Grid.Column="2" Grid.RowSpan="3" Gallery="Pie"> <ChartFX:Chart.ItemsSource> <Binding ElementName="DataGridControlTaskDetails" Path="ItemsSource"/> </ChartFX:Chart.ItemsSource> <ChartFX:Chart.DataTransforms> <ChartFXData:CrosstabTransform RowPath="RunStatusCode" Sorted="False"/> </ChartFX:Chart.DataTransforms> </ChartFX:Chart> Thanks, Rudi. Quote Link to comment Share on other sites More sharing options...
JuanC Posted December 1, 2008 Report Share Posted December 1, 2008 Note that the following approach (where you can use your own converter) will only change the displayed value on the legend box, if you hover on a pie slice you will still get a tooltip showing the numerical value of the RunStatusCode. In XAML <DataTemplate x:Key="legendTemplate"> <Grid x:Name="grid" Margin="{Binding Path=Margin}"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" SharedSizeGroup="FirstRow" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <cfxControls:MarkerLegendControl Content="{Binding Path=Self}" Grid.Column="0" /> <Border Background="Transparent" Grid.Column="1" VerticalAlignment="Center"> <TextBlock IsHitTestVisible="false" Text="{Binding Path=Content, ConverterGoesHere}" Foreground="{Binding Path=Foreground}" FontFamily="{Binding Path=FontFamily}" FontSize="{Binding Path=FontSize}" FontStyle="{Binding Path=FontStyle}" FontWeight="{Binding Path=FontWeight}"/> </Border> </Grid> <DataTemplate.Triggers> <DataTrigger Binding="{Binding Path=Dimmed}"> <DataTrigger.Value> <sys:Boolean>True</sys:Boolean> </DataTrigger.Value> <Setter Property="Opacity" Value="0.25" TargetName="grid" /> </DataTrigger> </DataTemplate.Triggers></DataTemplate>You might need the following namespaces in your root node xmlns:cfxControls="clr-namespace:ChartFX.WPF.Controls;assembly=ChartFX.WPF"xmlns:sys="clr-namespace:System;assembly=mscorlib"In your code you will need the following chart1.LegendBox.ItemAttributes[chart1.AxisX].Template = (DataTemplate) FindResource("legendTemplate"); Regards,JuanC Quote Link to comment Share on other sites More sharing options...
rudi Posted December 5, 2008 Author Report Share Posted December 5, 2008 Thanks, works well and I would never have figured this out myself. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.