This is a migrated thread and some comments may be shown as answers.

Unable to capture user input or show tooltips on Scatter plot data points

7 Answers 143 Views
Chart for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Thomas
Top achievements
Rank 1
Thomas asked on 10 Aug 2012, 04:23 AM
Hi,

Thanks for making the Win8 XAML controls, the charts have been very handy so far.

I've attempted to make a Scatter plot, and I'd like the user to be able to click the data points, or hover over them with a mouse to get extra information. I've tried doing this by editing the PointTemplate, but no user input seems to reach the Templates. I was wondering if it were possible to enable this, or how you would go about doing user interaction with Scatter plot data points, thanks!

Here is the code I have:

<telerik:RadCartesianChart x:Name="FirstChart" PaletteName="DefaultDark" Height="300">
                        <telerik:RadCartesianChart.HorizontalAxis>
                            <telerik:LinearAxis x:Name="FirstChartXAxis" MajorStep="100" />
                        </telerik:RadCartesianChart.HorizontalAxis>
                        <telerik:RadCartesianChart.VerticalAxis>
                            <telerik:LinearAxis MajorStep="1"/>
                        </telerik:RadCartesianChart.VerticalAxis>
                        <telerik:RadCartesianChart.Grid>
                            <telerik:CartesianChartGrid MajorLinesVisibility="XY"/>
                        </telerik:RadCartesianChart.Grid>
                        <telerik:ScatterPointSeries ItemsSource="{Binding}">
                            <telerik:ScatterPointSeries.XValueBinding>
                                <telerik:PropertyNameDataPointBinding PropertyName="Reviews"/>
                            </telerik:ScatterPointSeries.XValueBinding>
                            <telerik:ScatterPointSeries.YValueBinding>
                                <telerik:PropertyNameDataPointBinding PropertyName="rating"/>
                            </telerik:ScatterPointSeries.YValueBinding>
                            <telerik:ScatterPointSeries.PointTemplate>
                                <DataTemplate>
                                    <Button>
                                        test
                                    </Button>
                                    <!--<Border Width="8" Height="8" Background="#FFCD1717" BorderThickness="1" BorderBrush="Black" ToolTipService.ToolTip="test" ToolTipService.Placement="Top">
                                         
</Border>-->
                                </DataTemplate>
                            </telerik:ScatterPointSeries.PointTemplate>
                        </telerik:ScatterPointSeries>
                         
                    </telerik:RadCartesianChart>

Thanks,
Tommy

7 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 10 Aug 2012, 08:16 AM
Hi Tommy,

Thank you for contacting us and for your question.

ChartSeries instances by default are not hit-test visible. This is done for the sake of performance and for centralizing event handling at a root level - RadChart.

In your case, you can simply set the IsHitTestVisible property of the scatter series to true and everything should be working as expected. Something like this:

<telerik:AreaSeries IsHitTestVisible="True">
    <telerik:AreaSeries.PointTemplate>
        <DataTemplate>
            <Button Content="Click" Click="Button_Click_1"/>
        </DataTemplate>
    </telerik:AreaSeries.PointTemplate>
</telerik:AreaSeries>

I hope this helps. Let me know if you have other questions.

Kind regards,
Georgi
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Thomas
Top achievements
Rank 1
answered on 10 Aug 2012, 03:19 PM
This works great, thanks Georgi!

0
Binay
Top achievements
Rank 1
answered on 13 Jan 2014, 01:15 PM

Hi,

I need to get the selected item(selected point) from ScatterPointSeries chart so that I can get the object of the SelectedItem to display some information related to that individual point. I am not sure how I can accomplish this.



-Binay


0
Binay
Top achievements
Rank 1
answered on 13 Jan 2014, 01:16 PM

Hi,

I need to get the selected item(selected point) from ScatterPointSeries chart so that I can get the object of the SelectedItem to display some information related to that individual point. I am not sure how I can accomplish this.







-Binay




0
Ivaylo Gergov
Telerik team
answered on 15 Jan 2014, 11:24 AM
Hi,

You can get the selected point/points through the ChartSelectionBehavior.SelectedPoints property and then access its data item through the ScatterDataPoint.DataItem property. For your convenience I have attached an example of how to achieve this. Please see the attached file.

Let me know if you need further assistance.

Regards,
Ivaylo Gergov
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Jason
Top achievements
Rank 1
answered on 20 Mar 2014, 02:54 PM
That whole "IsHitTestVisible" thing -- you might want to mention that setting that to "True" is necessary for the TooltipBehavior in the following documentation so we don't have to wander around the forums to discover that piece of information:

http://www.telerik.com/help/windows-8-xaml/radchart-behaviors-charttooltipbehavior.html
0
Jason
Top achievements
Rank 1
answered on 20 Mar 2014, 03:00 PM
Never mind.  I misunderstood.
Tags
Chart for XAML
Asked by
Thomas
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Thomas
Top achievements
Rank 1
Binay
Top achievements
Rank 1
Ivaylo Gergov
Telerik team
Jason
Top achievements
Rank 1
Share this question
or