Mick Posted February 4, 2010 Report Share Posted February 4, 2010 I retemplated the labels for a pie chart following the directions at this post: http://community.softwarefx.com/forums/p/8822/20612.aspx#20612. However, when I combine label templating with an OtherTransform, the label for the OtherTransform isn't applied - instead, it's a percent (the default label). Is there a way to make the two use the same label ("Other"), or do I have to choose between templating labels orusing an OtherTransform? Thank you, Mick Quote Link to comment Share on other sites More sharing options...
JuanC Posted February 5, 2010 Report Share Posted February 5, 2010 We have added a property called LabelTemplate to the OtherTransform class in build 3688 that will allow you to set a custom DataTemplate for the Other element. JuanC Quote Link to comment Share on other sites More sharing options...
Mick Posted February 11, 2010 Author Report Share Posted February 11, 2010 Is there a property on the OtherTransform that I can get to through my DataTemplate? IF so, what is its binding path? For example, I may want to display "Other (3%)" or "Other (5 items)" instead of hardcoding "Other" as my pie slice name. This is what I have currently: Labels: <DataTemplate x:Key="ChartFXPieLabelTemplate" > <Label Content="{Binding Path=DataItem.Content}" ... Other ("Other" is hard coded) <DataTemplate x:Key="ChartFXPieLabelOtherTemplate" > <Label Content="Other" ...--- Thank you, Mick Quote Link to comment Share on other sites More sharing options...
JuanC Posted February 12, 2010 Report Share Posted February 12, 2010 You can display the number of items by using the DataItem.Items.Count path, note that we expose the items collection, and we use this in the tooltip to display the detail of all the elements grouped in the Other bucket. <TextBlock Text="{Binding Path=DataItem.Items.Count}"/> To show the accumulated value or percentage you can use ToolTipConverter, the advantage of using this is that it knows about Axis settings, e.g. if you set the Axis.Format to currency it will show the currency sign when displaying the value, e.g. xmlns:cfxConverters="clr-namespace:ChartFX.WPF.Converters;assembly=ChartFX.WPF" <DataTemplate.Resources> <cfxConverters:TooltipConverter x:Key="MyTooltipConverter"/></DataTemplate.Resources> <TextBlock> <TextBlock.Text> <Binding Path="Self" Converter="{StaticResource MyTooltipConverter}" ConverterParameter="V: %v P: %p%%" /> </TextBlock.Text></TextBlock> JuanC WpfApplication1Modified.zip 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.