> For the complete documentation index, see [llms.txt](https://docs.toomuchmedia.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.toomuchmedia.com/nats-admin/skins-and-templates/further-reading/template-functions/nats_display_graph.md).

# nats\_display\_graph

Alias: display\_graph

## Parameters

(*Required parameters in bold)*

| Parameter           | Description                                                         | Possible Values                                | Default Value                  | Example                                         |
| ------------------- | ------------------------------------------------------------------- | ---------------------------------------------- | ------------------------------ | ----------------------------------------------- |
| width               | Width of the graph in pixels                                        | Any whole number greater than 0                | 400                            | width="800"                                     |
| height              | Height of the graph in pixels                                       | Any whole number greater than 0                | 250                            | height="800"                                    |
| period              | The period to get statistics for                                    | Any valid period number or string description  | 0 or date                      | period="7" or period='week'                     |
| stats               | The variable to get statistics from                                 | An array                                       | $stats\[$range]                | stats=$stats\['date'] or $stats\['site']        |
| bgcolor             | The background color for the graph                                  | Any background color specification             | 0xe7e9eb                       | bgcolor="green"                                 |
| plot\_bgcolor       | Background color for the plot                                       | Any background color specification             | Transparent                    | bgcolor="blue"                                  |
| img\_width          | Width of the image in pixels                                        | Any whole number greater than zero             | Same as width parameter above  | img\_width="800"                                |
| img\_height         | Height of the image in pixels                                       | Any whole number greater than zero             | Same as height parameter above | img\_height="800"                               |
| plot\_width         | Width of the plot in pixels                                         | Any whole number greater than zero             | Same as width parameter above  | plot\_widht="800"                               |
| plot\_height        | Height of the plot in pixels                                        | Any whole number greater than zero             | Same as height parameter above | plot\_height="800"                              |
| legend\_bgcolor     | Background color of the legend                                      | Any color specification                        | Transparent                    | legend\_bgcolor="green"                         |
| plot\_left\_margin  | Left margin of the plot in number of pixels relative to the border  | Any whole number greater than or equal to zero | 0                              | plot\_left\_margin="100"                        |
| plot\_right\_margin | Right margin of the plot in number of pixels relative to the border | Any whole number greater than or equal to zero | 0                              | plot\_right\_margin                             |
| breakdown           | How to breakdown the statistics in the chart                        | Any valid breakdown method                     | date                           | breakdown="program"                             |
| period              | What period to display the chart for                                | Any valid period I.D.                          | 0                              | period="7"                                      |
| fields              | The variables that the line graph is based on                       | A variable in $stats\[$range]                  | none                           | fields = joins,recurring,refunds,reversals      |
| field\_titles       | The line graph titles                                               | any string                                     | none                           | field\_titles = Joins,Rebills,Refunds,Reversals |
| fields2             | The variables that the bar graph is based on.                       | A variable in $stats\[$range]                  | none                           | fields2 = join\_submits,join\_hits,impression   |
| field\_titles2      | The bar graph titles                                                | any string                                     | none                           | field\_titles2 = Submits,Join Hits,Raw Hits     |
| show\_legend        | Show legend or not.                                                 | 0 (hide) or 1 (show)                           | 0                              | show\_legend = 1                                |
| name                | Name of the graph                                                   | Any HTML encoded string                        | Random                         | name="my\_chart"                                |
| reference\_date     | The reference point for the start and end dates.                    | Any valid free formed date.                    | now                            | reference\_date='last Thursday'                 |
| loginid             | I.D. of the user to get data for                                    | Any valid user I.D.                            | Current user's I.D. number     | loginid="123"                                   |

## Output

A graph that is generated from the parameters supplied to the display\_graph template function.<br>

For example:

{% code overflow="wrap" %}

```
{display_graph width=988 height=290 type=TMM plot_width=896 plot_height=240 plot_bgcolor=0xFFFFFF bgcolor=0xDDDDDD 
edge_color=0x000000 stats=$stats[$range] chart_type=TMM fields=joins,recurring,refunds,reversals breakdown=$range 
field_titles=Joins,Rebills,Refunds,Reversals field_titles2="Submits,Join Hits,Raw Hits" field_color0=0xffaa71 
field_color1=0xdd8851 field_color2=0xaa0000 fields2=join_submits,join_hits,impression field_color20=0x91b1d7 
field_color21=0x7191b7 field_color22=0x517191 legend_x=45 legend_y=-2 left_margin=40 top_margin=26 show_legend=1 
name=$name plot_edge_color=0xe5e5e5 plot_hgrid_color=0xe5e5e5 xaxis_tick_color=0xd3dde8 yaxis_label_offset=0 
xaxis_label_gap=0}
```

{% endcode %}

The Smarty template function call above will display a graph that has a bar graph component and a line graph component as defined by the "fields1" and "fields2" parameters as shown below.

## Notes

The reference date refers to the date that the start date and the end date (in the date range form) use as a reference point.

For example:

Setting reference\_date = 'today' and start\_date to 'last Thursday' will set start\_date to last Thursday relative to today.

The end date uses the reference\_date as a reference point in the same way.

If you wanted to show qualified hits on your graph, you would simply add "qualified" to either the "fields" parameter or the "fields2" parameter (depending on whether you wanted to show it as a line or a bar graph), and "Qualified Hits" to the "field\_titles" or the "fields\_titles2" parameters.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.toomuchmedia.com/nats-admin/skins-and-templates/further-reading/template-functions/nats_display_graph.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
