Search code examples
c#wpfdynamic-data-display

dynamic data display chartplotter get current axis values


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 so far. But not sure how to get any further to achieve my objective.

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

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

Any pointer in the right direction is much appreciated.

Thank you!


Solution

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

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