Home Demos

An example autoscaling time axis

This examples shows how to create a timeline axis which autoscales to contain all the available data.

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.

In this example, the function y=x is plotted, and the numerical value is displayed as a straightforward number along the horizontal axis, but rendered as a date along the vertical axis.

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