You are here

README.txt in Charts 7.2

Charts
======

Charts module provides a unified format to build any kind of chart with any
chart provider.

Each chart solution found on internet, like Google Charts and Highcharts,
have a specific data scheme. Its very hard and even impossible to build a unique
chart data that would be used in more that one chart provider. Or users get
binded to a solution forever or they have to rewrite all exported data again.

Thats why Charts is so great. It uses a standard data scheme do describe charts
data and thru filters, it converts automatically to each solution. You might
change to another solution at anytime.

The Chart schema is very similiar to Drupal's Form API schema.

Chart Providers
---------------

Out of the Box, you will be able to use 2 chart solutions. Which one of them
has particular advantages and disadvantages.

* Google Charts: This library does not require any external downloads. It
  generates interactive charts using SVG and VML.

* Highcharts: This library is one of the premier solutions for generating
  charts. Although it is very powerful and aesthetically pleasing with smooth
  animations, it requires a commercial license. It's free for non-commercial
  use. See http://www.highcharts.com

Installing Highcharts
---------------------

If you decide to use the Highcharts library, you'll need to first install the
Libraries module for Drupal: https://drupal.org/project/libraries

Then you'll need to download Highcharts and place it in sites/all/libraries
directory. The highcharts.js file should be located at:
sites/all/libraries/highcharts/js/highcharts.js. You will also need to remove a
directory called "exporting-server" within the Highcharts download. This
directory contains sample code for exporting charts that may compromise the
security of your site. The module will throw an error if this directory is left
in place.

Creating Charts in the UI
-------------------------

This module provides a configuration page at admin/config/content/charts. You
may set site-wide defaults on this page (for example set the default color
scheme).

In order to actuall create a chart through the UI, you'll need to use Views
module.

- Create a new view:
  Visit admin/structure/views/add and select the display format of "Chart" for
  your new page or block.

- Enable aggregation on the view:
  In order to display data, most of the time you'll need enable aggregation on
  the view. Under the right column of settings, there is a section for
  "Use aggregation". Enable this setting.

- Add a label field:
  Under the "Fields" section, add a field you would like to be used as labels
  along one axis of the chart (or slices of the pie). In the "Aggregation type"
  setting, set it to "Group results together".

- Add data fields:
  Now a second field which will be used to determine the data values. Usually
  this will be an ID field, such as NID or CID. The label you give this field
  will be used in the chart's legend to represent this series. After adding the
  field, set the "Aggregation type" for this field to "Count". Do this again for
  each different quantity you would like to chart. Note that some charts
  (e.g. Pie) only support a single data column.

- Configure the chart display:
  Click on the "Settings" link in the Format section to configure the chart.
  Select your chart type. Some options may not be available to all chart types
  and will be adjusted based on the type selected. Because no live preview is
  available in Charts, you may need to open a saved version of the view in a
  different window to see the impact of your changes.

- Save your view.

Tip: You may find it easier to start with a "Table" display and convert it to a
chart display after setting up the data. It can be easier to visualize what
the result of the chart will be if it's been laid out in a table first.

Creating Multiple Series and Combo Charts in the UI
---------------------------------------------------

When using Views to build your charts, you may find it difficult to retrieve
more than a single set of data generated by a COUNT() query. For example if you
wanted to retrieve the age of all your site users, but display "Male" and
"Female" values in a column chart at the same time, constructing the underlying
table of data is quite difficult.

To solve this problem, you can combine multiple charts on top of each other. The
"parent" chart provides the global information, such as the height, width,
title, and other properties. Charts that are "children" provide only data and
(optionally) a secondary axis. After you've assembled the first series of data
in your chart according to the instructions in the "Creating Charts in the UI"
section, add a new display to the same view of the type "Chart Add-on". The
"Chart Add-on" type is added the same way you would add a new Page or Block
display, from the "+ Add" menu at the top of the view configuration.

After this new display has been added, find the setting for "Combine with parent
chart" and change this value to point at the parent chart you have already
assembled. Then adjust the settings for the child chart to pull in different
data (often by overriding the filter settings). Now you can go back to your
parent display, and see that the results from the child chart have been
merged into the results from the parent chart. You can even use this approach
to combine different types of charts, such as a line chart over the top of
a column chart. Note that not all chart types can be combined together and
invalid combinations may cause your chart to throw errors.

Create Charts through the API
-----------------------------

Charts module includes an extensive API for creating charts through code. See
the charts.api.php file included with this module for documentation.

Support
-------

For bug reports and feature requests please use the Drupal.org issue tracker:
http://drupal.org/project/issues/charts.

File

README.txt
View source
  1. Charts
  2. ======
  3. Charts module provides a unified format to build any kind of chart with any
  4. chart provider.
  5. Each chart solution found on internet, like Google Charts and Highcharts,
  6. have a specific data scheme. Its very hard and even impossible to build a unique
  7. chart data that would be used in more that one chart provider. Or users get
  8. binded to a solution forever or they have to rewrite all exported data again.
  9. Thats why Charts is so great. It uses a standard data scheme do describe charts
  10. data and thru filters, it converts automatically to each solution. You might
  11. change to another solution at anytime.
  12. The Chart schema is very similiar to Drupal's Form API schema.
  13. Chart Providers
  14. ---------------
  15. Out of the Box, you will be able to use 2 chart solutions. Which one of them
  16. has particular advantages and disadvantages.
  17. * Google Charts: This library does not require any external downloads. It
  18. generates interactive charts using SVG and VML.
  19. * Highcharts: This library is one of the premier solutions for generating
  20. charts. Although it is very powerful and aesthetically pleasing with smooth
  21. animations, it requires a commercial license. It's free for non-commercial
  22. use. See http://www.highcharts.com
  23. Installing Highcharts
  24. ---------------------
  25. If you decide to use the Highcharts library, you'll need to first install the
  26. Libraries module for Drupal: https://drupal.org/project/libraries
  27. Then you'll need to download Highcharts and place it in sites/all/libraries
  28. directory. The highcharts.js file should be located at:
  29. sites/all/libraries/highcharts/js/highcharts.js. You will also need to remove a
  30. directory called "exporting-server" within the Highcharts download. This
  31. directory contains sample code for exporting charts that may compromise the
  32. security of your site. The module will throw an error if this directory is left
  33. in place.
  34. Creating Charts in the UI
  35. -------------------------
  36. This module provides a configuration page at admin/config/content/charts. You
  37. may set site-wide defaults on this page (for example set the default color
  38. scheme).
  39. In order to actuall create a chart through the UI, you'll need to use Views
  40. module.
  41. - Create a new view:
  42. Visit admin/structure/views/add and select the display format of "Chart" for
  43. your new page or block.
  44. - Enable aggregation on the view:
  45. In order to display data, most of the time you'll need enable aggregation on
  46. the view. Under the right column of settings, there is a section for
  47. "Use aggregation". Enable this setting.
  48. - Add a label field:
  49. Under the "Fields" section, add a field you would like to be used as labels
  50. along one axis of the chart (or slices of the pie). In the "Aggregation type"
  51. setting, set it to "Group results together".
  52. - Add data fields:
  53. Now a second field which will be used to determine the data values. Usually
  54. this will be an ID field, such as NID or CID. The label you give this field
  55. will be used in the chart's legend to represent this series. After adding the
  56. field, set the "Aggregation type" for this field to "Count". Do this again for
  57. each different quantity you would like to chart. Note that some charts
  58. (e.g. Pie) only support a single data column.
  59. - Configure the chart display:
  60. Click on the "Settings" link in the Format section to configure the chart.
  61. Select your chart type. Some options may not be available to all chart types
  62. and will be adjusted based on the type selected. Because no live preview is
  63. available in Charts, you may need to open a saved version of the view in a
  64. different window to see the impact of your changes.
  65. - Save your view.
  66. Tip: You may find it easier to start with a "Table" display and convert it to a
  67. chart display after setting up the data. It can be easier to visualize what
  68. the result of the chart will be if it's been laid out in a table first.
  69. Creating Multiple Series and Combo Charts in the UI
  70. ---------------------------------------------------
  71. When using Views to build your charts, you may find it difficult to retrieve
  72. more than a single set of data generated by a COUNT() query. For example if you
  73. wanted to retrieve the age of all your site users, but display "Male" and
  74. "Female" values in a column chart at the same time, constructing the underlying
  75. table of data is quite difficult.
  76. To solve this problem, you can combine multiple charts on top of each other. The
  77. "parent" chart provides the global information, such as the height, width,
  78. title, and other properties. Charts that are "children" provide only data and
  79. (optionally) a secondary axis. After you've assembled the first series of data
  80. in your chart according to the instructions in the "Creating Charts in the UI"
  81. section, add a new display to the same view of the type "Chart Add-on". The
  82. "Chart Add-on" type is added the same way you would add a new Page or Block
  83. display, from the "+ Add" menu at the top of the view configuration.
  84. After this new display has been added, find the setting for "Combine with parent
  85. chart" and change this value to point at the parent chart you have already
  86. assembled. Then adjust the settings for the child chart to pull in different
  87. data (often by overriding the filter settings). Now you can go back to your
  88. parent display, and see that the results from the child chart have been
  89. merged into the results from the parent chart. You can even use this approach
  90. to combine different types of charts, such as a line chart over the top of
  91. a column chart. Note that not all chart types can be combined together and
  92. invalid combinations may cause your chart to throw errors.
  93. Create Charts through the API
  94. -----------------------------
  95. Charts module includes an extensive API for creating charts through code. See
  96. the charts.api.php file included with this module for documentation.
  97. Support
  98. -------
  99. For bug reports and feature requests please use the Drupal.org issue tracker:
  100. http://drupal.org/project/issues/charts.