ChartToolKit ToolTip

Aug 25, 2010 at 9:39 PM
  Hi below is the code I used to custom ToolTip for pie chart...ToolTip comes but piechart won't display .... If i remove opacity for Grid it will display Pie chart but doesn't show any effect for mouseover and selected effect..... <!--Blue-->
  <chartToolKit:PieSeries.Palette>
                    <visual:ResourceDictionaryCollection>
                        <ResourceDictionary>
                            <!--Blue-->
                            <Style x:Key="DataPointStyle" TargetType ="chartToolKit:PieDataPoint">
                                <Setter Property="Background">
                                    <Setter.Value>
                                        <RadialGradientBrush>
                                            <RadialGradientBrush.RelativeTransform>
                                                <TransformGroup>
                                                    <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="2.09" ScaleY="1.819" />
                                                    <TranslateTransform X="-0.425" Y="-0.486" />
                                                </TransformGroup>
                                            </RadialGradientBrush.RelativeTransform>
                                            <GradientStop Color="#FFB9D6F7" />
                                            <GradientStop Color="#FF284B70" Offset="1" />
                                        </RadialGradientBrush>
                                    </Setter.Value>
                                </Setter>
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="chartToolKit:PieDataPoint">
                                            <Grid x:Name="Root" Opacity="0">
                                                <VisualStateManager.VisualStateGroups>
                                                    <VisualStateGroup x:Name="CommonStates">
                                                        <VisualStateGroup.Transitions>
                                                            <VisualTransition GeneratedDuration="0:0:0.1" />
                                                        </VisualStateGroup.Transitions>
                                                        <VisualState x:Name="Normal" />
                                                        <VisualState x:Name="MouseOver">
                                                            <Storyboard>
                                                                <DoubleAnimation Storyboard.TargetName="MouseOverHighlight" Storyboard.TargetProperty="Opacity" To="0.6" Duration="0" />
                                                            </Storyboard>
                                                        </VisualState>
                                                    </VisualStateGroup>
                                                    <VisualStateGroup x:Name="SelectionStates">
                                                        <VisualStateGroup.Transitions>
                                                            <VisualTransition GeneratedDuration="0:0:0.1" />
                                                        </VisualStateGroup.Transitions>
                                                        <VisualState x:Name="Unselected" />
                                                        <VisualState x:Name="Selected">
                                                            <Storyboard>
                                                                <DoubleAnimation Storyboard.TargetName="SelectionHighlight" Storyboard.TargetProperty="Opacity" To="0.6" Duration="0" />
                                                            </Storyboard>
                                                        </VisualState>
                                                    </VisualStateGroup>
                                                    <VisualStateGroup x:Name="RevealStates">
                                                        <VisualStateGroup.Transitions>
                                                            <VisualTransition GeneratedDuration="0:0:0.5" />
                                                        </VisualStateGroup.Transitions>
                                                        <VisualState x:Name="Shown">
                                                            <Storyboard>
                                                                <DoubleAnimation Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                                                            </Storyboard>
                                                        </VisualState>
                                                        <VisualState x:Name="Hidden">
                                                            <Storyboard>
                                                                <DoubleAnimation Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity" To="0" Duration="0" />
                                                            </Storyboard>
                                                        </VisualState>
                                                    </VisualStateGroup>
                                                </VisualStateManager.VisualStateGroups>
                                                <Path x:Name="Slice" Data="{TemplateBinding Geometry}" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeMiterLimit="1">
                                                    <ToolTipService.ToolTip>
                                                        <StackPanel>
                                                            <ContentControl Content="{TemplateBinding IndependentValue}" />
                                                            <ContentControl Content="{TemplateBinding FormattedDependentValue}" 
                                                            ContentStringFormat="Counts {0:###,###,###}"/>
                                                            <ContentControl Content="{TemplateBinding FormattedRatio}" />
                                                        </StackPanel>
                                                    </ToolTipService.ToolTip>
                                                </Path>
                                                <Path x:Name="SelectionHighlight" Data="{TemplateBinding GeometrySelection}" Fill="Red" StrokeMiterLimit="1" IsHitTestVisible="False" Opacity="0" />
                                                <Path x:Name="MouseOverHighlight" Data="{TemplateBinding GeometryHighlight}" Fill="White" StrokeMiterLimit="1" IsHitTestVisible="False" Opacity="0" />
                                            </Grid>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>

                        </ResourceDictionary>
<!-- <Setter Property="Background"> <Setter.Value> <RadialGradientBrush> <RadialGradientBrush.RelativeTransform> <TransformGroup> <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="2.09" ScaleY="1.819" /> <TranslateTransform X="-0.425" Y="-0.486" /> </TransformGroup> </RadialGradientBrush.RelativeTransform> <GradientStop Color="#FFB9D6F7" /> <GradientStop Color="#FF284B70" Offset="1" /> </RadialGradientBrush> </Setter.Value> </Setter> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="chartToolKit:PieDataPoint"> <Grid x:Name="Root" Opacity="0"> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="CommonStates"> <VisualStateGroup.Transitions> <VisualTransition GeneratedDuration="0:0:0.1" /> </VisualStateGroup.Transitions> <VisualState x:Name="Normal" /> <VisualState x:Name="MouseOver"> <Storyboard> <DoubleAnimation Storyboard.TargetName="MouseOverHighlight" Storyboard.TargetProperty="Opacity" To="0.6" Duration="0" /> </Storyboard> </VisualState> </VisualStateGroup> <VisualStateGroup x:Name="SelectionStates"> <VisualStateGroup.Transitions> <VisualTransition GeneratedDuration="0:0:0.1" /> </VisualStateGroup.Transitions> <VisualState x:Name="Unselected" /> <VisualState x:Name="Selected"> <Storyboard> <DoubleAnimation Storyboard.TargetName="SelectionHighlight" Storyboard.TargetProperty="Opacity" To="0.6" Duration="0" /> </Storyboard> </VisualState> </VisualStateGroup> <VisualStateGroup x:Name="RevealStates"> <VisualStateGroup.Transitions> <VisualTransition GeneratedDuration="0:0:0.5" /> </VisualStateGroup.Transitions> <VisualState x:Name="Shown"> <Storyboard> <DoubleAnimation Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity" To="1" Duration="0" /> </Storyboard> </VisualState> <VisualState x:Name="Hidden"> <Storyboard> <DoubleAnimation Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity" To="0" Duration="0" /> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Path x:Name="Slice" Data="{TemplateBinding Geometry}" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeMiterLimit="1"> <ToolTipService.ToolTip> <StackPanel> <ContentControl Content="{TemplateBinding IndependentValue}" /> <ContentControl Content="{TemplateBinding FormattedDependentValue}" ContentStringFormat="Counts {0:###,###,###}" /> <ContentControl Content="{TemplateBinding FormattedRatio}" /> </StackPanel> </ToolTipService.ToolTip> </Path> <Path x:Name="SelectionHighlight" Data="{TemplateBinding GeometrySelection}" Fill="Red" StrokeMiterLimit="1" IsHitTestVisible="False" Opacity="0" /> <Path x:Name="MouseOverHighlight" Data="{TemplateBinding GeometryHighlight}" Fill="White" StrokeMiterLimit="1" IsHitTestVisible="False" Opacity="0" /> </Grid> </ControlTemplate> </Setter.Value> </Setter> -->
Aug 26, 2010 at 12:19 AM

Methinks you posted this in the wrong group.

 

Aug 27, 2010 at 5:10 PM

Hi, did you get to any solution on this. I´m having the same problem with Stack bars and BarDataPoint style.

Aug 27, 2010 at 5:47 PM

Hi I didn't find any solution for this problem, but I think VisualStateManager is not working for mouse event.... But I am not sure....

Aug 27, 2010 at 5:58 PM

Guys, this has nothing to do with Unity. Don't you think it would be more productive discussing this in a Silverlight group?

 

Aug 27, 2010 at 6:03 PM

I have moved this post to wpfToolkit forum http://wpf.codeplex.com/Thread/View.aspx?ThreadId=225094

Aug 27, 2010 at 6:17 PM

Thanks