This is part of a series that includes Java applet and Processing.js examples.


If your browser prompts you to abort the script because it is taking too long, make sure you click 'No'. The 8760 hourly data points required for a whole year can take a while to initially process, which is why this message occurs in some browsers.


This is an embedded Flash applet that, for some reason, does not resize itself particularly well to fit within it's parent div. If you change the width of your browser significantly, you will need to refresh the page to get a better fit.

Google Finance Graph

This is an embedded Flash applet from Google that demonstrates an annual data graph. Click and drag the date slider at the bottom with the left mouse button to control the amount of the year shown and the start-date.

Keyboard Controls

The Google graph does not appear to respond to any keyboard controls.

Mouse Controls

  • Click & Drag:
    To interact with the graph, click and drag either the start/stop day nodes or the scrolling block bar at the very bottom. The graph will update when you release the mouse button. If you click and drag within the graph itself, you can scroll backwards and forwards through the year.

  • Mouse Wheel:
    You can use the mouse wheel to interactively adjust the start date, thereby zooming in/out on the data.

Including the Graph

Including such a graph is pretty simple. Google provide an extensive gallery of graph types together with example code for generating them. The above is an ‘Annotated Time Line’, so it’s code is shown below.

Data Collection

The hourly temperature data for this graph was extracted from Autodesk Ecotect. A script was used to extract and format the temperature data suitable for use as a Google DataTable. You will need to make sure that you have loaded a model with a selected Weather data file in Ecotect or simply select one using Model => Model Settings… => Date/Time/Location before running this script.

-- Make sure weather data is loaded. cmd("weather.load") -- Start the data table. print("data.addRows(["); -- ---------------------------------- function formatDataLine(julianday, month, day, hour, value) line = format(" [new Date(2001, %2d, %2d, %2d), %5.1f]", month, day, hour, value); if (julianday < 365) or (hour < 23) then line = line .. ","; end print(line) end -- ---------------------------------- for d = 1,365 do -- Set date to get day/month. set("model.dayoftheyear", d, 12.0) month = get("model.month") day = get("") for h = 0,23 do formatDataLine(d, month, day, h, get("weather.temperature", d, h)) end end -- End the data table. print(" ]);");

Click here to comment on this page.