in

Software FX Community

Discuss and find help for all Software FX products.

Pie Labels and OtherTransform

Last post 02-12-2010 11:09 AM by JuanC. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 02-04-2010 11:18 AM

    • Mick
    • Top 25 Contributor
    • Joined on 03-23-2009

    Pie Labels and OtherTransform

    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


  • 02-05-2010 3:21 PM In reply to

    • JuanC
    • Top 10 Contributor
    • Joined on 03-02-2007

    Re: Pie Labels and OtherTransform

    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

  • 02-11-2010 5:10 PM In reply to

    • Mick
    • Top 25 Contributor
    • Joined on 03-23-2009

    Re: Pie Labels and OtherTransform

    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

  • 02-12-2010 11:09 AM In reply to

    • JuanC
    • Top 10 Contributor
    • Joined on 03-02-2007

    Re: Pie Labels and OtherTransform

    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 

Page 1 of 1 (4 items)
Copyright 2008 Software FX, Inc.