Calculating x-axis range dynamically

- [Instructor] Okay, so now that we have properties…for capturing the lowest and highest values…to be shown on the x-axis, we now want to go…and change that minimum and maximum,…so the displayed range of values of the x-axis,…every time we receive a new value.…Why, because we want the values to scroll across the screen.…And so I'll say here on line 65,…AdjustAxis.…Based on what? The ticks.…So Ft is our data,…and it has a timestamp,…which has ticks.…

And so, I'm going to have to write a method…that changes the range of the x-axis,…the start and end of the x-axis,…based on the latest value of the latest line in the file.…So going down to AdjustAxis.…A little bit of math for us.…So remember the width of our axis was about 30 seconds.…So think of this as the range of values…that you want to display.…Timespan from seconds.…I want to display about 30 seconds worth of data.…

And so, just trust me on this one.…I had to do a bit of experimentation here…to actually figure this out.…But essentially, the axis minimum value…needs to be something,…

Resume Transcript Auto-Scroll

Author

Released

10/31/2018

Successful programmers know more than just how to code. They also know how to think about solving problems. Code Clinic is a series of courses in which our instructors solve the same problems using different programming languages. In each course, instructors provide tips and tricks for working in a particular language and help you grasp why you might want to learn one language over another. Here, Anton Delsink works with C#. Throughout the course, Anton introduces challenges and then provides an overview of his solutions in C#. Challenges include topics such as geolocation, face recognition, and accessing peripherals. Visit other courses in the series to see how to solve the same challenges in languages like C++, JavaScript, PHP, Python, Ruby, Go, and Swift.