Jump to content
Software FX Community

Use of a converter with a CrosstabTransformation


Recommended Posts


 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">


<Binding ElementName="DataGridControlTaskDetails" Path="ItemsSource"/>



<ChartFXData:CrosstabTransform RowPath="RunStatusCode" Sorted="False"/>






Link to comment
Share on other sites

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.



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


In your code you will need the following

chart1.LegendBox.ItemAttributes[chart1.AxisX].Template = (DataTemplate) FindResource("legendTemplate");



Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...