Book Image

HTML5 Data and Services Cookbook

Book Image

HTML5 Data and Services Cookbook

Overview of this book

HTML5 is everywhere. From PCs to tablets to smartphones and even TVs, the web is the most ubiquitous application platform and information medium bar. Its becoming a first class citizen in established operating systems such as Microsoft Windows 8 as well as the primary platform of new operating systems such as Google Chrome OS. "HTML5 Data and Services Cookbook" contains over 100 recipes explaining how to utilize modern features and techniques when building websites or web applications. This book will help you to explore the full power of HTML5 - from number rounding to advanced graphics to real-time data binding. "HTML5 Data and Services Cookbook" starts with the display of text and related data. Then you will be guided through graphs and animated visualizations followed by input and input controls. Data serialization, validation and communication with the server as well as modern frameworks with advanced features like automatic data binding and server communication will also be covered in detail.This book covers a fast track into new libraries and features that are part of HTML5!
Table of Contents (21 chapters)
HTML5 Data and Services Cookbook
About the Authors
About the Reviewers

Zooming and panning a chart

The charts we discussed in the preceding chapter of this book were static. As such, they're great for visualizing limited quantities of data. However, when the dataset grows too large, users might be needed to interactively choose the range of data shown in the chart.

To enable this, we're going to make a chart that is capable of interactive controls, such as zooming and panning. The Flot chart library easily supports this with its navigation plugin.

In this recipe, we're going to show a one week temperature history at 30 minute increments. We're going to allow the user to zoom and pan the history.

Getting ready

We'll need to download Flot from the official website and extract the contents to a separate folder flot.

How to do it...

To create this recipe, we will add Flot, jQuery, and create an HTML file.

  1. First, we create a basic HTML page with a placeholder for our chart. We're also going to include jQuery (needed by Flot), Flot itself, and...