RadCartesianChart ToolTip

2 posts, 0 answers
  1. Levon
    Levon avatar
    17 posts
    Member since:
    May 2013

    Posted 25 Jun 2013 Link to this post

    I have a RadCartesianChart and two series in it - BarSeries and LineSeries.
    My LineSeries have only two points. the first point of my BarSeries and the last one of it. It shows the average value of the BarSeries-so it is a straight line. I want to have tooltip on the whole line.Currently I have only on the points of my LineSeries. Is it possible to see the tooltip everywhere I hover the line?
  2. Rosko
    Admin
    Rosko avatar
    137 posts

    Posted 28 Jun 2013 Link to this post

    Hi Levon,

    For your scenario, it is better to use the Annotations feature of RadCartesianChart. You can check the corresponding online demo with source code and online help topic.

    Also, for you scenario specifically, you can check the following code snippet which demonstrates two possible approaches. You just need to copy-paste into a project to see the result.
    <telerik:RadCartesianChart x:Name="chart" IsHitTestVisible="True">
                <telerik:RadCartesianChart.HorizontalAxis>
                    <telerik:CategoricalAxis x:Name="horizontalAxis"/>
                </telerik:RadCartesianChart.HorizontalAxis>
                <telerik:RadCartesianChart.VerticalAxis>
                    <telerik:LinearAxis x:Name="verticalAxis"/>
                </telerik:RadCartesianChart.VerticalAxis>
                <telerik:RadCartesianChart.Series>
                    <telerik:BarSeries>
                        <telerik:BarSeries.DataPoints>
                            <telerik:CategoricalDataPoint Category="1" Value="1"/>
                            <telerik:CategoricalDataPoint Category="2" Value="2"/>
                            <telerik:CategoricalDataPoint Category="3" Value="3"/>
                            <telerik:CategoricalDataPoint Category="4" Value="4"/>
                            <telerik:CategoricalDataPoint Category="5" Value="5"/>
                            <telerik:CategoricalDataPoint Category="6" Value="6"/>
                        </telerik:BarSeries.DataPoints>
                    </telerik:BarSeries>
                </telerik:RadCartesianChart.Series>
                <telerik:RadCartesianChart.Behaviors>
                    <telerik:ChartTooltipBehavior/>
                </telerik:RadCartesianChart.Behaviors>
                <telerik:RadCartesianChart.Annotations>
                    <telerik:CartesianGridLineAnnotation x:Name="gridLineAnnotation"
                                                         Axis="{Binding ElementName=verticalAxis}"
                                                         Value="4.5"
                                                         StrokeThickness="3"
                                                         Stroke="Green"
                                                         Label="Average value: 4.5"
                                                         IsHitTestVisible="True"
                                                         telerik:RadToolTipService.ToolTipContent="Average value: 4.5"
                                                         telerik:RadToolTipService.PlacementTarget="{Binding ElementName=chart}">
                                                          
                    </telerik:CartesianGridLineAnnotation>
                    <telerik:CartesianCustomLineAnnotation x:Name="customLineAnnotation"
                                                           VerticalFrom="2.5" VerticalTo="2.5"
                                                           HorizontalFrom="1" HorizontalTo="6"
                                                           StrokeThickness="3"
                                                           Stroke="Red"
                                                           IsHitTestVisible="True"
                                                           telerik:RadToolTipService.ToolTipContent="Average value: 3.5"
                                                           telerik:RadToolTipService.PlacementTarget="{Binding ElementName=chart}"/>
                </telerik:RadCartesianChart.Annotations>
            </telerik:RadCartesianChart>



    Regards,
    Rosko
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft banner
Back to Top