Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1500
Display the full words in LegendItem tooltip
posted

Hello:

Because the LegendItem will auto cut off the words with "..." when the words is too long, as follow chart:

The full words is "Well11111111111111111111111111111Two"

So I want to display the full words by LegendItem tooltip, but the tooltip also didnot display full words, as follow chart

 

How can I get the full words to display in the tooltip?

Parents
  • 1134
    posted

    Hi,

    I was able to achieve this for a single series using the following style:

     <Style TargetType="igChart:LegendItem" x:Name="LegendItemStyle1">
    
                <Setter Property="Foreground" Value="#FF617583"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="igChart:LegendItem">
                            <Grid x:Name="RootElement">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Rectangle RadiusX="3" RadiusY="3" x:Name="LegendItemIcon" Grid.Column="0"
                                       Width="13" Height="13" 
                                       Fill="{TemplateBinding Fill}" 
                                       Stroke="{TemplateBinding Stroke}" 
                                       StrokeThickness="{TemplateBinding StrokeThickness}"
                                       />
                                <TextBlock x:Name="LegendItemText" Margin="5,0,0,0"  Width="Auto" Height="Auto" Grid.Column="1"
                                       Text="{TemplateBinding Text}"
                                       Foreground="Black">
                                       <ToolTipService.ToolTip>
                                           <TextBlock Width="300" Height="Auto" Text="{Binding ElementName=Chart1, Path=Series[0].Label}"/>
                                       </ToolTipService.ToolTip>
                                 </TextBlock>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
    

    However, the limitation here is that you can set the style only the Legend using the LegendItemStyle property, which means you're limited to only one series for this to work properly.  I basically templated the Tooltip to be a textblock and bound its text to the label of the first series in the chart.  Simply binding it to the LegendItem text won't work, because the LegendItem text actually becomes the truncated version, as opposed to the series label (which you would expect).  Perhaps you'll be able to further implement this to use for more than one series.

    Hope this is a start,

    Marisa

Reply Children
No Data