Pragmatically Set Trackball Location

19 posts, 0 answers
  1. Shawn
    Shawn avatar
    22 posts
    Member since:
    Jul 2011

    Posted 26 Mar 2012 Link to this post

    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
  2. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 29 Mar 2012 Link to this post

    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 >>
  3. DevCraft banner
  4. Shawn
    Shawn avatar
    22 posts
    Member since:
    Jul 2011

    Posted 29 Mar 2012 Link to this post

    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
  5. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 03 Apr 2012 Link to this post

    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 >>
  6. Shawn
    Shawn avatar
    22 posts
    Member since:
    Jul 2011

    Posted 04 Apr 2012 Link to this post

    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
  7. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 09 Apr 2012 Link to this post

    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 >>

  8. BENOIT CHEVALIER
    BENOIT CHEVALIER avatar
    22 posts
    Member since:
    Nov 2009

    Posted 12 Apr 2012 Link to this post

    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
  9. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 13 Apr 2012 Link to this post

    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 >>

  10. Deamon
    Deamon avatar
    8 posts
    Member since:
    Nov 2012

    Posted 16 Nov 2012 Link to this post

    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
  11. Edward Wilde
    Edward Wilde avatar
    8 posts
    Member since:
    Jun 2005

    Posted 11 Dec 2012 Link to this post

    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.

  12. Jacob
    Jacob avatar
    2 posts
    Member since:
    Oct 2012

    Posted 11 Dec 2012 Link to this post

    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?
  13. Edward Wilde
    Edward Wilde avatar
    8 posts
    Member since:
    Jun 2005

    Posted 11 Dec 2012 Link to this post

    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! :( 



  14. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 12 Dec 2012 Link to this post

    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.

  15. Chetan
    Chetan avatar
    26 posts
    Member since:
    Oct 2012

    Posted 19 May 2013 Link to this post

    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.
  16. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 22 May 2013 Link to this post

    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.

  17. Jacob
    Jacob avatar
    2 posts
    Member since:
    Oct 2012

    Posted 28 May 2013 Link to this post

    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
  18. Chetan
    Chetan avatar
    26 posts
    Member since:
    Oct 2012

    Posted 30 May 2013 Link to this post

    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.
  19. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 30 May 2013 Link to this post

    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.

  20. Chetan
    Chetan avatar
    26 posts
    Member since:
    Oct 2012

    Posted 02 Jun 2013 Link to this post

    Thats work for me, perfectly

    Thankyou very much.
Back to Top
DevCraft banner