Click here to Skip to main content
15,067,832 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am working with d3 chartplotter. In my application, I want the program to automatically detect the current start and end values of my horizontal axis on display. For example, let us say the user zooms in the data plotted. I know the axis value will be automatically adjusted and displayed on the plotter. What I want is (upon a button click maybe), the program should extract what is the start and end value of the X-axis on display at that moment. I need these two values to do some other thing. I am using C# wpf for programming btw. I tried searching for it in forums, but no luck so far. Here's what I have including some pseudocode for what i eventually want the program to do. But not sure how to get any further to achieve my objective.

C#
CursorCoordinateGraph coordinategraph = new CursorCoordinateGraph(); plotter.Children.Add(coordinategraph);

Upon some_buttonclick()
{ Retrieve the first and last x-coordinate value on display...}



Any pointer in the right direction is much appreciated.

Thank you!
Posted

1 solution

I figured it out. happened to be too simple :)

C#
var v = plotter.Visible;
int X_left = Convert.ToInt32(v.Left);
int X_right = Convert.ToInt32(v.Right); 
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900