Data Visualization
Overriding visualization settings
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, changing the size, and so on. Before 1.0.4, you'd need to create a separate visualization - now you can use the same one.
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:
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:
PHP
A typical PHP function call looks like this:
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.
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.