Home Demos

An example time axis

This examples shows how to create a timeline axis.

The horizontal axis of this plot is set to display as a timeline by setting the dataType setting on the axis_x1 axis of the JSPlot_Graph instance to timestamp. In this mode, the numerical values along the axis are interpreted as Unix timestamps, and displayed as times and/or dates, depending on the range of the axis.

For illustrative purposes, the function displayed here increases linearly through each day, from zero at midnight to one the following midnight, before reverting to zero again at the start of the next day.

You can click and drag the graph horizontally to change the horizontal axis range, or use the mouse scroll wheel to zoom in or out.

Source code for this page