This page acquires real time weather information from a buoy in the Pacific Ocean off the central California coast. Since the data acquisition process is lengthy and the data only changes every hour, we don't want to re-read the data every time the page is refreshed. By storing our data in an "application" scope bean named "buoy", our DataProvider is available to every page in the application, and it won't contact the NOAA web site until the DataProvider's timeout (1 hour) has been reached.
The "buoy" DataProvider stores a variety of information, including wind, temperature, and wave height data. We use "datafilter" tags to split the data up into various charts, and to narrow the number of days we're looking at.
|
Wind Information
If wind speeds exceed 20 MPH, you should see a reference line that indicates a gale warning. |
|
|
Temps
This buoy seems to have intermittent temperature data. Missing values are indicated by a broken line. |
|
|
Wave Heights
When wave heights at this buoy exceed 10 feet, you probably don't want to be in the water. A storm level warning reference line should appear on the chart. |
|
|
Wave Height Distribution
By wrapping our data source in the KavaChart ProServe "datahistogram" tag, we can do a quick ad-hoc visual analysis of wave heights in California's Monterey Bay. The Y axis tells us how many observations are in each "bin", while the X axis label tells us the mean height of that particular bin. The chart usually forms a natural looking bell curve if you have enough observations, since we're looking at natural data. |
|
In addition to optimizing our data sources, these charts are stored on the server using the ProServe "cached" tag. That means the charts won't be regenerated if they already exist at the server. While this probably isn't a big optimization for a demonstration application, if you have thousands of users viewing your pages, the savings in server resources can be significant.
Try changing the number of days with the form below to see what the performance is like, re-calculating data sources, rendering new charts, evaluating a new histogram, etc.