Making a chart component with Angular directives

Angular directives allow us to extend the HTML syntax in a very powerful way—by adding new attributes and elements. This allows us to create components that feel native: from date and time pickers to data grids, charts, and visualizations.

Such components can then be reused without adding initialization code to our controllers. We simply tell the component what model it should bind to and it will automatically update its appearance to reflect any changes in the model.

In this recipe, we're going to make a chart directive using Flot to draw our chart. In the process, we will learn about some of the many powerful features of Angular directives.

Getting ready

We need to download Flot from http://www.flotcharts.org/ ...

Get HTML5 Data and Services Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.