C++ C Objective-C
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Description ----------- This example demonstrates one way of plotting a large amount of time-series data using smart data sampling and Core Plot. The file being plotted is one channel of an uncompressed audio file in WAV format. The file was recorded at a standard 44.1KHz rate and is a little over 18 seconds long. It has 806,400 samples. Trying to plot all 806,400 samples using Core Plot takes several seconds on OS X and also consumes a large amount of memory. In all fairness, Core Plot does a pretty good job given how much work it is being asked to do. However, it is unnecessary effort since you would need over 300 30" Cinema Displays lined up left to right in order to discern every data point. This example application uses min/max sampling of the data set to generate a fairly accurate representation of the data while keeping memory and CPU usage in check. The application queries the plot hosting view's width and samples the data set accordingly. When the window is resized, the data set is resampled and the plot is redrawn. When you zoom in far enough so that the ratio of viewable_samples to plot_view_width drops below 2, sampling is turned off and the raw data points are fed to Core Plot. Installation ------------ This example will compile as-is if you put it in the examples directory of your core-plot distribution. Otherwise, adjust the Build Settings to point to the correct location of the Core Plot framework. Acknowledgements ---------------- This post about using the ExtAudioFile API on CocoaDev was very helpful: http://www.cocoadev.com/index.pl?ExtAudioFile Author ------ Jeff Buck