Is there any kind of "Smart Placement" option for the TrackBallInfo in ChartView?

1 Answer 57 Views
ChartView
Joe
Top achievements
Rank 2
Iron
Iron
Veteran
Joe asked on 15 Aug 2022, 05:48 PM
Right now, my trackball information appears directly over the mouse point.  It obscures the trackball line and the point on the plot about which info is being shown.  Like this:





What I would like is some sort of "smart" placement that puts the tip on one side or the other -- or even above, based on how much room is available.  Here's a crude example I hacked up merely by hard-coding the margin to be 100 pixels offset

            <tk:RadCartesianChart.TrackBallInfoStyle> 
                <Style TargetType="{x:Type tk:TrackBallInfoControl}"> 
                    <Setter Property="Margin" Value="100 0 0 0"/>
                </Style> 
            </tk:RadCartesianChart.TrackBallInfoStyle> 
The result is better but obviously does nothing to account for the actual font size (which could make 100 pixels not enough or too much) or location of the mouse on the control.  If I'm on the far right side of my chart, I want this info tip to move to the left so I can still read all of it.



As you can see, I've customized the TrackBallInfoTemplate quite a bit.   Maybe this option already existed and I broke it/neglected to set it in my customizations?  I cannot see any properties on the control that might let me set it.

Does anything like this exist?  Or do I need a really complicated converter...?

1 Answer, 1 is accepted

Sort by
0
Accepted
Martin Ivanov
Telerik team
answered on 16 Aug 2022, 07:55 PM

Hello Joe,

No, there is no smart placement for the trackball info bubble. To achieve your requirement, you will need to update the Margin dynamically, based on the size of the bubble. In order to update the Margin, first you can use the FindChildByType extension method to get the TrackBallInfoControl in the Loaded event handler of the chart. Then, you can use the MouseMove event of the chart or the TrackInfoUpdated event of the trackball behavior in order to try getting or calculating the current trackball info height and move it accordingly.

An alternative approach would be to hide the TrackBallInfoControl by setting the ShowTrackInfo property of the trackball behavior to False. Then, you can display a separate visual element statically positioned next to the chart and update its information using the TrackInfoUpdated event.

I hope this information helps.

Regards,
Martin Ivanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Joe
Top achievements
Rank 2
Iron
Iron
Veteran
commented on 17 Aug 2022, 12:21 AM

Yeah, that's what I figured.

More work maybe, but I can do that. 

Thanks, Martin!
Tags
ChartView
Asked by
Joe
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Martin Ivanov
Telerik team
Share this question
or