Book Image

Mastering Angular 2 Components

By : Gion Kunz
Book Image

Mastering Angular 2 Components

By: Gion Kunz

Overview of this book

<p>Through this book, you will learn how to use Angular 2 and its component-based architecture in order to develop modern user interfaces. A new holistic way of thinking about UI development will be established throughout this book, and you will discover the power of Angular 2 components through many examples. This book is based on Release Candidate 1(RC1) of Angular 2.</p> <p>On this journey, you'll discover the benefits of component-based user interfaces over the classical MVC design. Also, you will get a chance to compare a classical MVC with a component-based approach and understand the challenges of modern user interfaces. You will learn the very basics of the required core technologies and the setup needed to get going with Angular 2, and progressively enhance your understanding of Angular 2 components by working on the example application.</p> <p>After reading the book and following the example application, you will have built a small-to-mid-sized application with Angular 2 using a component-based UI architecture.</p>
Table of Contents (19 chapters)
Mastering Angular 2 Components
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Visualizing open tasks


In this section, we will create a chart component using Chartist, which will display the open task progress of projects over time. To do this, we'll use a line chart with a specific interpolation that provides quantized steps rather than lines with directly connected points.

We are also providing some interactivity in that the user will be able to switch the displayed time frame using a toggle button. This allows us to reuse the Toggle component that we created in Chapter 2, Ready, Set, Go!, of this book.

Let's first look at the data that we have in our system and how we can transform it into the data needed by Chartist.

We can rely on two data attributes of our tasks in order to draw them onto a timeline. The created attribute is set to the timestamp at the moment when the task was created. If a task is marked as done, the done attribute is set to the timestamp at that time.

As we're only interested in the amount of open tasks at any given time, we can safely presume...