Graphina Documentation

Optimizing Element Sets in Graphina with PHP Hooks


Graphina, a powerful data visualization plugin for WordPress, allows extensive customization through PHP hooks. One such hook is graphina_max_series_value, which enables users to control the highest value displayed in a series.

Controlling Maximum Series Value in Graphina

The following PHP filter allows you to set a custom maximum value for your Graphina charts:

add_filter('graphina_max_series_value', function($series_value) {
    // Set a custom maximum series value
    return 30;
});

What This Hook Does:

  • Controls the highest value displayed in the series: By using this filter, you can define a custom maximum limit for your dataset.
  • Ensures consistency in chart scaling: Useful for keeping the visual representation within a defined range.
  • Prevents unexpected behavior: Ensure that the returned value is always a valid integer to avoid rendering issues.

Example Screenshot

Using this hook, you can fine-tune how data is displayed in Graphina, ensuring better readability and consistency in your WordPress charts. Customize further based on your specific dataset needs!


🎯 Use Case: Controlling Max Data Points in Charts

By default, Graphina has a maximum limit for chart elements to maintain performance and readability. However, if you’re dealing with larger datasets or just need more flexibility, PHP hooks come to the rescue.

Let’s say you want to display up to 30 rows or columns in your chart. All you need to do is add the following code snippet to your theme’s functions.php file or a custom plugin:

add_filter('graphina_max_row_value', function() {
// Set a custom maximum series value
return 30;
});

add_filter('graphina_max_column_value', function() {
// Set a custom maximum series value
return 30;
});

🛠️ How It Works

  • graphina_max_row_value: This filter controls the maximum number of rows your chart can display.
  • graphina_max_column_value: Similarly, this sets the limit for the number of columns.

You can customize the returned value to suit your project needs. Whether it’s 20, 30, or 100 – Graphina will adjust accordingly, as long as your system can handle the rendering.


🔐 Pro Tip: Use with Caution

While increasing the data limits can be useful, keep in mind:

  • Higher numbers may affect performance on slower devices or shared hosting environments.
  • Always test changes on a staging site before pushing to production.

🚀 Final Thoughts

Graphina continues to impress with its developer-friendly approach. Using PHP hooks like graphina_max_row_value and graphina_max_column_valueYou can take full control over your chart display and enhance your WordPress data visualization capabilities.

For more advanced options and detailed documentation, check out the official Graphina PHP Hooks guide.