How WordPress Developers use GFChart to set up Charts and Reports

GFChart code for WordPress developers

GFChart is an extension to Gravity Forms which allows you to produce charts and calculations from forms submissions.

It’s designed for WordPress web developers, designers and site owners. We’ve attempted to make GFChart as user friendly as possible, including hooks throughout the code and a public API for you to customize the software as needed.

The code itself will always be your best resource for the available hooks and how to use them (e.g. Want to know how to create a new chart type? Look at the ‘Charting vs Time Add-On’ code in our Documentation Add-On section).

Below we’ve outlined some of the common actions we’ve seen used by Developers, as well as the hooks necessary to achieve them to save some searching time.

Create your own chart types

  • gfchart_chart_types: define the chart type
  • gfchart_config_file_paths: tell us where to find your admin configuration views
  • gfchart_admin_enqueue_scripts: add any JS needed for the admin configuration
  • gfchart_shortcode_scripts: add JS needed to display chart

Adjust chart filters

  • gfchart_get_filter_vars: filter the configured chart filters
  • Change chart configuration

Change chart configuration

  • gfchart_config: filter the configuration values set in the admin configuration UI
  • Change data after it’s been formatted for Google Charts
  • Example: adding style columns
  • gfchart_api_format_bar_chart_data

Chart your own data

  • Example: re-ordering data for display
  • gfchart_data_retriever_get_bar_chart_data: filter retrieved bar chart data before it’s formatted for Google Charts

Change Google chart options

  • gfchart_api_format_chart_options: filter Google Chart-formatted options
  • Note: If you simply need to control the look-and-feel of your charts, you can add your own Google Charts options in the additional code setting on the Customiser tab.

Using an alternative chart API

  • You’d need to format the data for the chart API and then handle the front-end JS
  • gfchart_shortcode_scripts

If you need your forms to provide actionable information with easy setup, then GFChart is what you need.