Nats display graph

From TMMwiki
Jump to: navigation, search
NATS 4
    Template Functions
nats_add_to_array
nats_adtool_replace_linkcode
nats_array_flip
nats_array_to_xml
nats_build_array_by_reference
nats_convert_bytes
nats_decode
nats_display_account_campaigns
nats_display_account_change_history
nats_display_account_notifications
nats_display_account_preview
nats_display_admin_links
nats_display_admin_message
nats_display_adtool_form
nats_display_adtool_types
nats_display_adtools
nats_display_adtools_type_limit
nats_display_choose_adtools_group
nats_display_code_info
nats_display_create_campaign
nats_display_edit_account_details
nats_display_edit_account_settings
nats_display_edit_defaults
nats_display_edit_password
nats_display_edit_payvia
nats_display_edit_payvia_info
nats_display_edit_skin
nats_display_gallery_builder
nats_display_graph
nats_display_hourly_sales
nats_display_latest_adtools
nats_display_map
nats_display_news
nats_display_page_peel
nats_display_payment_history
nats_display_payment_summary
nats_display_ratio
nats_display_reward_category
nats_display_reward_order
nats_display_reward_purchases
nats_display_signup_advanced
nats_display_signup_basic
nats_display_signup_payvia
nats_display_stats
nats_display_stats_calendar
nats_display_stats_form
nats_display_stats_referrals
nats_display_stats_retention
nats_display_stats_subscription_details
nats_display_stats_table
nats_display_timezones
nats_display_top_stats
nats_dump_data
nats_encode
nats_get_first_in_array
nats_get_period_end
nats_get_reward_categories
nats_get_member
nats_list_adtool_groups
nats_list_affiliates
nats_list_billers
nats_list_campaigns
nats_list_linkcodes
nats_list_options
nats_get_option_details
nats_list_programs
nats_list_sites
nats_list_tool_categories
nats_list_tours
nats_list_xsells
nats_smarty_function_amount_owed
nats_smarty_function_getbonus
nats_smarty_rebuild_form
nats_smarty_rebuild_link
nats_smarty_rebuild_query
nats_tooltip
nats_track_link
nats_strack_link
tmm_admin_pagination
Template Shortcuts
add_to_array
adtool_replace_linkcode
affiliate_select_form
array_flip
array_to_xml
amount_owed
build_array_by_reference
convert_bytes
display_account_campaigns
display_account_change_history
display_account_notifications
display_account_preview
display_admin_links
display_adtool_form
display_adtool_types
display_adtools
display_adtools_type_limit
display_choose_adtools_group
display_code_info
display_create_campaign
display_gallery_builder
display_stats_referrals
display_edit_account_details
display_edit_account_settings
display_edit_defaults
display_edit_password
display_edit_payvia
display_edit_payvia_info
display_edit_skin
display_graph
display_hourly_sales
display_latest_adtools
display_map
display_news
display_page_peel
display_payment_history
display_payment_summary
display_ratio
display_reward_category
display_reward_order
display_reward_purchases
display_signup_advanced
display_signup_basic
display_signup_payvia
display_stats
display_stats_calendar
display_stats_table
display_stats_form
display_stats_retention
display_stats_subscription_details
display_top_stats
display_timezones
dump_data
get_first
get_period_end
get_reward_categories
list_billers
list_campaigns
list_linkcodes
list_options
list_programs
list_sites
list_tool_categories
list_tours
list_xsells
rebuild_form
rebuild_link
rebuild_query
reward_points
tooltip
Common Parameters
assign
assign_prefix
count
data_only
display_on_assign
start
tpl

nats_display_graph

Displays a graph of affiliate statistics.

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.
For example:

{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}

width=988 height=290 These parameters set the width and the height of the graph window.
type=TMM This sets the type of the graph to a TooMuchMedia default graph (both line and bar graph)
plot_width=896 plot_height=240 This sets the size of the x and y axes in the graph.
plot_bgcolor=0xFFFFFF This sets the background color of the plot area.
bgcolor=0xDDDDDD This sets the background color of the graph window.
edge_color=0x000000 This sets the color of the edge of the background window.
stats=$stats[$range] This is the array that the statistics are taken from.
chart_type=TMM This sets the type of the chart to TooMuchMedia default graph
fields=joins,recurring,refunds,reversals These are the fields in the "stats" parameter that represent the statistics of the line graph shown below.
field_titles=Joins,Rebills,Refunds,Reversals These are the titles for the fields defined in the "fields" parameter.
fields_titles2=Submits, Join Hits, Raw Hits These are the titles for the fields defined in the "fields2" parameter.
fields_color0=0xffaa71 This sets the color of the join line graph.
fields_color1=0xdd8851 This sets the color of the rebills line graph.
fields_color2=0xaa0000 This sets the color of the refunds line graph.
fields2=join_submits,join_hits,impression These are the fields in the "stats" parameter that represent the statistics of the bar graph shown below.
field_color20=0x91b1d7 This sets the color of the Submits field in the bar graph.
field_color21=0x7191b7 This sets the color of the Join Hits field in the bar graph.
field_color22=0x517191 This sets the color of the Raw Hits field in the bar graph.
legend_x=45 This sets the x position of the legend
legend_y=-2 This sets the y position of the legend
left_margin=40 This is the left margin of the graph window
top_margin=26 This is the top margin of the graph window
show_legend=1 This sets whether the legend appears or not. 1 is show 0 is hide.
name=$name This sets the name of the graph.
plot_edge_color=0xe5e5e5 This sets the color for the edge of the plot.
plot_hgrid_color=0xe5e5e5 This sets the color of the horizontal grid lines.
xaxis_tick_color=0xd3dde8 This sets the color of the x axis.
yaxis_label_offset=0 This sets the offset of the y axis labels.
xaxis_label_gap=0 This sets the gap of the x axis labels.


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.


Sample graph.jpg

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.