Hello,
I am writing an application that loads a set of temperature vs. time data from a text file and displays the data on a graph. At the time the data is loaded, I run it through the Array Max/Min function to calculate these values and display them on the screen. The user can zoom in on part of the graph using the built-in zoom capability. Now I would like to recalculate the max and min values within the window that the user has selected. (I would like to maintain all of the original data in case the user zooms back out.)
I am trying to determine the most efficient way to accomplish this. What I have done so far is to get the chart x-scale minimum and maximum values from a chart property node, then find the index of these values in the original data array. I then use the indices with Array Subset to remove first the end, then the beginning from a copy of the array. Finally, I pass the data to the Array Max & Min function. This method seems to be very slow. This may be because it requires me to make copies of a large data array.
Is there a better way to do this without manipulating large arrays too much? Would it be faster to just iterate through the array and start capturing the max and min values only after the chart x-scale min is found? Ideally, I would like to create a version of the Max & Min function that takes a start and end index. Has anyone written such a function that is relatively fast?
Thank you,
Peter Laskey