This is a migrated thread and some comments may be shown as answers.
Pragmatically Set Trackball Location
18 Answers 190 Views
This is a migrated thread and some comments may be shown as answers.
Shawn
Top achievements
Rank 1
Shawn asked on 26 Mar 2012, 08:12 PM
Hello,

I was wondering if it is possible to pragmatically set the trackball location instead of having it follow the mouse on the chart.

Thank you,

Shawn

18 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 29 Mar 2012, 09:42 AM
Hi,

Presently, there is no easy way to preset this. If you would like to provide a different behavior, you can consider a separate approach - such as displaying a tooltip, or a separate grid with data.
I hope this information helps.

Kind regards,
Yavor
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Shawn
Top achievements
Rank 1
answered on 29 Mar 2012, 03:21 PM
Yavor,

Thank you for your response. You said there is no easy way to preset this. Is there perhaps a hard way to do it?

Also, can I suggest this as a future feature? It would be nice if there was some way to display the trackball and tell it to be at a certain position.

Thank you again,

Shawn
0
Yavor
Telerik team
answered on 03 Apr 2012, 02:04 PM
Hi,

This could be done, if the api for the functionality is exposed, and accessible. This is not the case at present, due to the architectural specifications of the control. We will consider your feedback, however at present presetting the trackball location is not supported.

All the best,
Yavor
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Shawn
Top achievements
Rank 1
answered on 04 Apr 2012, 08:29 PM
Yavor,

Thank you again for your reply.

Is there anyway I can recommend this to be an upcoming feature? Is there a way I can tell when it will guaranteed to be or not be a feature?

Thanks,
Shawn
0
Yavor
Telerik team
answered on 09 Apr 2012, 08:31 AM
Hello,

Basically, the current request goes against the architectural model of the control. The current functionality is meant for and limited to, tracking the mouse movements over the chart area and the series. While this may undergo slight modifications, for example considering the snap mode, it is not meant to allow presetting the trackball location, or exposing any of the api behind it.
Nevertheless, I will pass your suggestion to our developers, so that they are aware of the scenario.

All the best,
Yavor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
BENOIT CHEVALIER
Top achievements
Rank 1
answered on 12 Apr 2012, 11:27 AM
Hi,

I too would like an API to control the trackball position. 

We have a chart and grid which show the same data. Currently when a user tracks over the chart the grid highlights the row representing that data by setting the selected Item of the grid to the dataItem on the trackball event. It would be nice to have it work in the opposite direction too where a user clicks a row in the grid and we show them where on the chart that relates to by putting the trackball line at that location.

Thanks
0
Yavor
Telerik team
answered on 13 Apr 2012, 06:31 AM
Hello,

I will pass your suggestion to our developers. Thank you for your feedback.

All the best,
Yavor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Deamon
Top achievements
Rank 2
answered on 16 Nov 2012, 05:52 PM
Me too.  I am trying to highlight one chart causing the trackball line to show and then I'd like to force the same line on a second chart under the first chart.  I am using the control in winforms rather than silverlight, however.

George
0
Edward Wilde
Top achievements
Rank 1
answered on 11 Dec 2012, 10:00 AM
Hi,

I have a very similar requirement which I'm unsure how to implement

I have two time-series graphs displayed one on top of the other, the business requirement is that they should remain separate graphs for two reasons:

  • The top-most graph is already plotting 4 series and anymore would make it unreadable
  • The bottom-most graph has a different scale on the y-axis (and should be displayed separately)

For each data point on the top graph there is a corresponding data point on the bottom graph (same time record with different values plotted on the y-axis)

The main requirement which i'm having issues with is:

When the trackball info is displayed on the bottom graph the corresponding trackball information should be displayed on the bottom graph.

Any ideas how I can achieve this with the current control, attached is a screenshot describing the issue

Regards,

Ed.

0
Michael
Top achievements
Rank 2
answered on 11 Dec 2012, 10:08 AM
I have the same requirement as well, I need to set the Cursor on both charts simultaneous.

Question to Telerik: Could we dig out the second Trackball from the visual tree and modifiy it's position & visibility on each TrackInfoUpdated?
0
Edward Wilde
Top achievements
Rank 1
answered on 11 Dec 2012, 11:53 AM
I have made some progress on this expanding on Michael's idea of grabbing the TrackBallInfoControl from the visual tree.

My approach:

  • Have two member fields MainTackBallInfoControl and SubTrackBallInfoControl

  • Initialize these fields the first time MainTackBallInfoControl info is updated
  • Data bind MainTackBallInfoControl.Left to enable us to position SubTrackBallInfoControl correctly
  • Hook MainTackBallInfoControl.IsVisibleChanged to synchronize visibility to SubTrackBallInfoControl
  • Force SubTrackBallInfoControl to update it's display information, calling internal method "Update"


Below is my OnTrackInfoUpdated method for MainTackBallInfoControl 


private void ChartTrackBallBehavior_OnTrackInfoUpdated(object sender, TrackBallInfoEventArgs e)
        {
            bool requiresInitialization = this.MainTackBallInfoControl == null;
 
            if (requiresInitialization)
            {
                this.MainTackBallInfoControl = this.MainChart.FindChildByType<TrackBallInfoControl>();
                this.SubTrackBallInfoControl =
                    this
                        .ChildrenOfType<TrackBallInfoControl>()
                        .First(item => item != this.MainTackBallInfoControl);
 
                this.MainTackBallInfoControl.IsVisibleChanged += (o, args) =>
                {
                    var isVisible = (bool)args.NewValue;
                    this.SubTrackBallInfoControl.Visibility = isVisible ? Visibility.Visible : Visibility.Collapsed;
                };
 
                this.MainTackBallInfoControl.SetBinding(Canvas.LeftProperty, new Binding("MainTackBallInfoControlLeft") { Mode = BindingMode.OneWayToSource });
 
                ((Screen)this.DataContext).PropertyChanged += (o, args) =>
                {
                    switch (args.PropertyName)
                    {
                        case "MainTackBallInfoControlLeft":
                            Canvas.SetLeft(this.SubTrackBallInfoControl, ((FakeRealTimeViewModel)this.DataContext).MainTackBallInfoControlLeft);
                            break;
                    }
                };
            }
 
            ReflectionUtil.ExecuteMethod("Update", this.SubTrackBallInfoControl, e);
        }

This didn't really work! :( 



0
Petar Marchev
Telerik team
answered on 12 Dec 2012, 12:28 PM
Hi everybody,

The TrackBall is pretty much like a tool tip, it reacts only when the mouse is over an element. Currently you can imitate synchronized track balls by using annotations. You can fully give up the TrackBallBehavior and use track-ball-like annotations instead. I have attached a small project demonstrating this.

We already have a feature request, about extending the TrackBall's API, logged in our PITS where you can vote for it and track its status.

Kind regards,
Petar Marchev
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Chetan
Top achievements
Rank 1
answered on 19 May 2013, 12:47 PM
Dear All,

A small Query,
Is there any way to change trackball info display location from top of chart to in between chart, where mouse pointer is exists. So that if it overlap with chart line series then due to changed mouse position user can remove overlapping.
0
Petar Marchev
Telerik team
answered on 22 May 2013, 06:50 AM
Chetan,

You can either find the visual TrackBallInfoControl and set an appropriate Margin, or you can update the previously attached sl-ChartView-527095.zip project so that the annotations are positioned elsewhere. One way to go is to add this code to the PlotArea_MouseMove event handler:
this.chart1.Annotations[1].Margin = new Thickness(0, mousePosition.Y, 0, 0);

Regards,
Petar Marchev
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Michael
Top achievements
Rank 2
answered on 28 May 2013, 05:04 AM
So back to the topic, is it now possible to set the trackball location from code?
Example: Two charts are displayed, they have the same time axis (see trackball.png)
Request: Show trackball on both charts at the same time
0
Chetan
Top achievements
Rank 1
answered on 30 May 2013, 06:47 AM

Hi All,

Ya its work with sample

this.chart1.Annotations[1].Margin = new Thickness(0, mousePosition.Y, 0, 0);

but I am working with VB.net Code, and tried as follow
Public Sub New()
       InitializeComponent()
       AddHandler RadChart1.LayoutUpdated, AddressOf RadChart1_LayoutUpdated
   End Sub
Private Sub RadChart1_LayoutUpdated(sender As Object, e As EventArgs)
       Dim plotAreaBorder = RadChart1.ChildrenOfType(Of Border).FirstOrDefault(Function(b) b.Name = "plotAreaDecoration")
       If plotAreaBorder IsNot Nothing Then
           RemoveHandler RadChart1.LayoutUpdated, AddressOf RadChart1_LayoutUpdated
           AddHandler plotAreaBorder.MouseMove, AddressOf PlotArea_MouseMove
       End If
   End Sub
   Private Sub PlotArea_MouseMove(sender As Object, e As MouseEventArgs)
       Dim mousePosition = e.GetPosition(Nothing)
       Me.RadChart1.Annotations(1).Margin = New Thickness(0, mousePosition.Y, 0, 0)
   End Sub

debugger goes in
AddHandler plotAreaBorder.MouseMove, AddressOf PlotArea_MouseMove
But event  PlotArea_MouseMove does not fire. Please let me know the code written is correct.
0
Petar Marchev
Telerik team
answered on 30 May 2013, 06:59 AM
Michael,

Currenlty there is no way to show the track ball from code behind, it only reacts on mouse interaction. You can work-around this by not using track ball but using annotations instead. A project was already provided for this - sl-ChartView-527095.zip. I hope this helps.

Regards,
Petar Marchev
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Chetan
Top achievements
Rank 1
answered on 02 Jun 2013, 07:37 AM
Thats work for me, perfectly

Thankyou very much.
Asked by
Shawn
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Shawn
Top achievements
Rank 1
BENOIT CHEVALIER
Top achievements
Rank 1
Deamon
Top achievements
Rank 2
Edward Wilde
Top achievements
Rank 1
Michael
Top achievements
Rank 2
Petar Marchev
Telerik team
Chetan
Top achievements
Rank 1
Share this question
or