Book Image

Highcharts Cookbook

By : Nicholas Terwoord
Book Image

Highcharts Cookbook

By: Nicholas Terwoord

Overview of this book

<p>Highcharts is a JavaScript library that enables web developers to create a wide range of different, highly customized charts. Highcharts easily integrates with existing JavaScript frameworks and is simple enough to make a column chart in a few lines of code, but flexible enough to handle more complex charting scenarios such as viewing multiple chart types with different data sources on a multitude of devices and form-factors.</p> <p>"Highcharts Cookbook" is a practical guide that provides you with clear, step-by-step recipes to create dynamic, functional charts in your web applications using Highcharts. With "Highcharts Cookbook", you will create and design dynamic and versatile charts in different scenarios.</p> <p>"Highcharts Cookbook" through its wide array of recipes will walk you through everything you need to know about Highcharts and will enable you to unleash its full potential in your web applications quickly and easily.</p> <p>You will learn how to integrate Highcharts with different frontend and backend libraries such as ExtJS, jQuery, and the Yii framework with some examples in Python, PHP, and NodeJS. You will also cover how to handle user interactions like form input and mouse events, how to fetch remote data in CSV, XML, and JSON format, and how to render charts for offline usage. If you want to learn the different ways you can leverage the power of Highcharts to create, integrate and extend its features in your application, then this book is for you.</p>
Table of Contents (19 chapters)
Highcharts Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating charts with a RESTful controller


For ease of understanding or just to make our API calls tidier, we may want to use RESTful services. This recipe looks at how we can make our existing services RESTful and how we can leverage these changes in our charts.

Getting ready

To set up the basic Yii project, refer to the Setting up a simple Yii Project recipe from this chapter.

We will also need to download and set up RestfullYii, an extension for the Yii framework using the following steps:

  1. Download the appropriate version of RestfullYii from the RestfullYii page (http://yiiframework.com/extension/restfullyii) and extract the contents to example_app/protected/extensions.

  2. Add an aliases entry in example_app/protected/config/main.php as shown in the following code:

    return array(
        'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
        'name'=>'My Web Application',
     
        'aliases' => array(
            'RestfullYii' =>realpath(__DIR__.'/../extensions/starship/RestfullYii'),
        )...