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

Display Info on Right Mouse Click

1 Answer 24 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Alan
Top achievements
Rank 1
Alan asked on 25 Jun 2019, 05:10 PM

Hello,

Is there a way to only display the TrackBall Info box when the right mouse button is clicked? We have a lot of info on our chart and sometimes the info box obscures the graph underneath.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 28 Jun 2019, 06:21 AM
Hello Alan,

To achieve your requirement, you can subscribe to the PositionChanging event of ChartTrackBallBehavior to cancel the trackball updates on mouse move. And then use the MouseRightButtonDown event to update the Position property of ChartTrackBallBehavior manually. Here is an example in code:
public partial class MainWindow : Window
    {
        private bool isManualPositionChange = false;
 
        public MainWindow()
        {
            InitializeComponent();
            this.trackballBehavior.Position = new Point(100, 321);
        }
 
        private void ChartTrackBallBehavior_PositionChanging(object sender, Telerik.Windows.Controls.ChartView.TrackBallPositionChangingEventArgs e)
        {
            if (e.NewPosition != e.PreviousPosition && !isManualPositionChange)
            {
                e.NewPosition = e.PreviousPosition;
            }           
            this.isManualPositionChange = false;
        }
 
        private void RadCartesianChart_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            isManualPositionChange = true;
            this.trackballBehavior.Position = e.GetPosition(this.chart);
        }
    }
I also attached a sample project showing this approach. I hope it helps.

Regards,
Martin Ivanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
ChartView
Asked by
Alan
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or