Book Image

Sencha Charts Essentials

By : Ajit Kumar
Book Image

Sencha Charts Essentials

By: Ajit Kumar

Overview of this book

Table of Contents (16 chapters)
Sencha Charts Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

Sencha Charts is a new and powerful library used to create rich and beautiful charts for your Sencha Touch and Ext JS applications. Built in HTML5, Sencha Charts is optimized for performance and fully supportive of gestures and touch devices to make visualizing data effortless.

What this book covers

Chapter 1, Fundamentals of Sencha Charts, covers the basic drawing constructs, such as line, circle, path, text, which are the fundamental building blocks of any charting library. It is using these drawing constructs that bar charts, pie charts, and so on, are created. This chapter explains how these building blocks are drawn on a screen using SVG and HTML5 Canvas APIs. It ends the discussion by showing how Sencha Charts uses these different APIs to abstract the device-specific and API-specific differences.

Chapter 2, Working with Out-of-the-box Charts, takes you through the different types of charts—cartesian, polar, and spacefilling—that come along with Sencha Charts, and demonstrates how they can be used in your application for data visualization. This chapter also offers the opportunity to understand the different concepts involved in creating charts using Sencha Charts, such as axis, legend, series, sprite, and so on.

Chapter 3, Sencha Charts Architecture, goes inside the framework and shows how the framework implements the architecture, internally. This chapter describes the overall architecture of Sencha Charts and sets the foundation for the subsequent topics where you will create custom charts.

Chapter 4, Creating a Custom Cartesian Chart, describes the detailed steps involved in creating a custom cartesian chart and provides the practical implementation of a stock chart—William %R—to apply the steps.

Chapter 5, Creating a Custom Polar Chart, describes the detailed steps involved in creating a custom polar chart and provides a practical implementation of a Market Clock to apply the steps.

Chapter 6, Creating a Custom Spacefilling Chart, describes the detailed steps involved in creating a custom spacefilling chart and provides the practical implementation of a periodic table to apply the steps.

Chapter 7, Theming, describes how theming—axis styling, legend styling, series colors, and so on—is supported in Sencha Charts and how you can leverage it to theme your charts. It also explains the theming-related considerations that you must have when you are implementing your own custom charts.

Chapter 8, Working with Touch Gestures, describes the different touch gestures that Sencha Charts supports and how some of the existing charts use them to engage users. It describes the configurations specific to different interactions and how to set them up on a chart. This chapter also explains how we can create custom interactions on a custom chart using touch gestures.

Chapter 9, Comparison with Other JavaScript Charting Libraries, compares Sencha Charts with other popular charting libraries, such as HighCharts, FusionCharts, amCharts, and Google Charts, to present a comparative study of different frameworks and their capabilities. It will describe, briefly, how the same task, for example, creating a custom cartesian chart, can be implemented in different libraries.

What you need for this book

You will need Sencha Cmd 5.0.2.270+, Ruby 2.0, Compass 1.0.1+, Oracle JDK 1.7+, Chrome browser (latest), a web server—XAMPP v3.2.1+ with Apache and a Windows, Linux, or Mac OS.

Who this book is for

This book is for Ext JS or Sencha Touch developer, designer, or architect who wants to build enterprise-scale data visualization capabilities using Sencha.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The for loop iterates through each of the sprites—sectors—that were created and sets their startRho and endRho attributes based on the runtime calculation."

A block of code is set as follows:

//show cross-hair
var overlay = drawCt.getSurface('overlay');
var hl, vl, headerOffset;

hl = this.createLine(-x0, -y0, -x0, -y0);
vl = this.createLine(-x0, -y0, -x0, -y0);
hl.lineDash = [5,5];
vl.lineDash = [5,5];
hl = overlay.add(hl);

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

items: [{
    xtype: 'periodictable',
    interactions: ['sce-itemhighlight'],
...

listeners: {
    itemhighlight: function(itemSelected) {
         if (itemSelected && itemSelected.record) {
              alert('Selected element is: ' + itemSelected.record.get(itemSelected.field));
         }
    }
}

Any command-line input or output is written as follows:

sencha generate app SCE /path/to/application/folder

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "There are two ways to draw in a browser—Scalable Vector Graphics (SVG) and Canvas API."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/9767OS_ColorImage.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.