« previous module | next module »

Extensions » Modules » Data Visualization

Documentation Translations Download

Overriding visualization settings


Activity Charts Field Charts Viewing your Visualizations Administration Other Stuff

This feature was added in 1.0.4.

When using your visualizations in the Pages module or in your own website, you may sometimes find it useful to override specific aspects of the visualization: changing the colour, hiding the title and so on. Before 1.0.4, you'd need to create a separate visualization. This new feature lets you get more out of each visualization.

The next two sections explain how to override the settings for in Smarty and PHP. The section at the bottom of the page describes all the settings that may be overridden.

Smarty

A typical Smarty function call looks like this:

{template_hook location="data_visualization" vis_id=1 height=300 width=600}

That will display the visualization (with ID of 1), with dimensions 600 x 300. To override any of the settings (listed below), just add them as separate attributes. For example, let's change the colour to "red" and add a custom title:

{template_hook location="data_visualization" vis_id=1 height=300 width=600 
  colour="red" title="My custom title!"}

PHP

A typical PHP function call looks like this:

<?php
require_once('/path/to/formtools/global/library.php');
ft_include_module("data_visualization");
$width  = 600;
$height = 300;
dv_display_visualization(1, $width, $height);
?>

That will display the visualization (with ID of 1), with dimensions 600 x 300. To override any of the settings (listed below), just add them as separate attributes. For example, let's do the same as above: change the colour to "red" and a custom title.

<?php
require_once('/path/to/formtools/global/library.php');
ft_include_module("data_visualization");
$width  = 600;
$height = 300;
$settings = array(
  "colour" => "red",
  "title"  => "My custom title!"
);
dv_display_visualization(1, $width, $height, $settings);
?>

Note the fourth parameter. That (optional) parameter is how you override the settings.


What may be overridden

Visualization Type Setting Permitted values
Activity Chart title any string
colour "red", "orange", "yellow", "green", "blue", "indigo", "violet", "black", "gray"
line_width any number 0-10
Field Chart title any string
pie_chart_format (for pie charts only) "3D" or "2D"
include_legend (for pie charts only) "yes" / "no"
colour "red", "orange", "yellow", "green", "blue", "indigo", "violet", "black", "gray"

Other tips!

  • The "colour" setting actually gives you more flexibility than is currently provided by the module's interface. In addition to specifying the colour strings ("red", "orange" and so on), you can also supply hex values, like "#C4159F".
  • If you don't want a title to your visualization, just override the title setting with an empty string.

No comments have been made on this page.

You need to be logged in to post a comment. Log in here or click here to get an account!