Docs & Support

Learn about all the Formidable features and get support from our amazing customer success team.

frm_google_chart

Use this hook to add or change the options in your Google chart.

Usage

add_filter('frm_google_chart', 'frm_add_graph_options', 10, 2);

Parameters

  • $options - array of graph options
  • $args - array of various graph variables

Examples

Move legend

Move the legend above the graph.

//Move legend to top of graphs
add_filter('frm_google_chart', 'frm_move_graph_legend', 10, 2);
function frm_move_graph_legend ($options, $args){
    $options['legend'] = array('position' => 'top', 'textStyle' => array('fontSize' => 10 ) );
    return $options;
}

Limit geo graph to specific region

A geo graph will show the entire world, by default. You may only show a specific region with the following code. Replace 'My graph title' with the title set in your graph shortcode. Replace 'IT' with the region of your choice. You may read more about the accepted regions here.

add_filter('frm_google_chart', 'frm_limit_graph_region', 10, 2);
function frm_limit_graph_region( $options, $args ) {
    if ( isset( $args['atts']['title'] ) && $args['atts']['title'] == 'My graph title' ) {
        $options['region'] = 'IT';
    }
    return $options;
}

Set title with special characters

Use the following code to set a graph title with special characters.

add_filter('frm_google_chart', 'frm_set_custom_graph_title', 10, 2);
function frm_set_custom_graph_title( $options, $args ) {
    if ( isset( $args['atts']['title'] ) && $args['atts']['title'] == 'My graph title' ) {
        $options['title'] = 'Test & Testing';
    }
    return $options;
}
Was this article helpful? *

This article may contain affiliate links. Once in a while, we earn commissions from those links. But we only recommend products we like, with or without commissions.

In this article

    We have a small, but amazing team of dedicated people who are committed to helping you achieve your goals and project requirements.


    Copyright © 2025 Strategy11, LLC. Formidable Forms® is a registered trademark Strategy11, LLC.

    Complete your purchase
    Special offer unlocked.
    Get 55% OFF!
    Complete Purchase
    Join 400,000+ using Formidable Forms to create form-focused solutions fast. Get Formidable Forms