{"id":633,"date":"2025-03-29T08:48:35","date_gmt":"2025-03-29T08:48:35","guid":{"rendered":"https:\/\/documentation.iqonic.design\/graphina\/?p=633"},"modified":"2025-04-11T05:21:52","modified_gmt":"2025-04-11T05:21:52","slug":"optimizing-element-sets-in-graphina-with-php-hooks","status":"publish","type":"post","link":"https:\/\/documentation.iqonic.design\/graphina\/optimizing-element-sets-in-graphina-with-php-hooks\/","title":{"rendered":"Optimizing Element Sets in Graphina with PHP Hooks"},"content":{"rendered":"<div class=\"nolwrap\">\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<p>Graphina, a powerful data visualization plugin for WordPress, allows extensive customization through PHP hooks. One such hook is <code>graphina_max_series_value<\/code>, which enables users to control the highest value displayed in a series.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Controlling Maximum Series Value in Graphina<\/h2>\n\n\n\n<p>The following PHP filter allows you to set a custom maximum value for your Graphina charts:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>add_filter('graphina_max_series_value', function($series_value) {\n    \/\/ Set a custom maximum series value\n    return 30;\n});<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">What This Hook Does:<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Controls the highest value displayed in the series<\/strong>: By using this filter, you can define a custom maximum limit for your dataset.<\/li>\n\n\n\n<li><strong>Ensures consistency in chart scaling<\/strong>: Useful for keeping the visual representation within a defined range.<\/li>\n\n\n\n<li><strong>Prevents unexpected behavior<\/strong>: Ensure that the returned value is always a valid integer to avoid rendering issues.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Example Screenshot<\/h3>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"461\" height=\"190\" src=\"https:\/\/documentation.iqonic.design\/graphina\/wp-content\/uploads\/sites\/3\/2025\/03\/image-53.png\" alt=\"\" class=\"wp-image-638\" \/><\/figure>\n\n\n\n<p>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!<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83c\udfaf Use Case: Controlling Max Data Points in Charts<\/h3>\n\n\n\n<p>By default, Graphina has a maximum limit for chart elements to maintain performance and readability. However, if you&#8217;re dealing with larger datasets or just need more flexibility, PHP hooks come to the rescue.<\/p>\n\n\n\n<p>Let\u2019s say you want to display <strong>up to 30 rows or columns<\/strong> in your chart. All you need to do is add the following code snippet to your theme\u2019s <code>functions.php<\/code> file or a custom plugin:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted .wp-block-preformatted { background: black; }\"><code>add_filter('graphina_max_row_value', function() {<br>    \/\/ Set a custom maximum series value<br>    return 30;<br>});<br><br>add_filter('graphina_max_column_value', function() {<br>    \/\/ Set a custom maximum series value<br>    return 30;<br>});<br><\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83d\udee0\ufe0f How It Works<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>graphina_max_row_value<\/code>: This filter controls the maximum number of rows your chart can display.<\/li>\n\n\n\n<li><code>graphina_max_column_value<\/code>: Similarly, this sets the limit for the number of columns.<\/li>\n<\/ul>\n\n\n\n<p>You can customize the returned value to suit your project needs. Whether it&#8217;s 20, 30, or 100 \u2013 Graphina will adjust accordingly, as long as your system can handle the rendering.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83d\udd10 Pro Tip: Use with Caution<\/h3>\n\n\n\n<p>While increasing the data limits can be useful, keep in mind:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Higher numbers may affect performance on slower devices or shared hosting environments.<\/li>\n\n\n\n<li>Always test changes on a staging site before pushing to production.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83d\ude80 Final Thoughts<\/h3>\n\n\n\n<p>Graphina continues to impress with its developer-friendly approach. Using PHP hooks like <code>graphina_max_row_value<\/code> and <code>graphina_max_column_value<\/code>You can take full control over your chart display and enhance your WordPress data visualization capabilities.<\/p>\n\n\n\n<p>For more advanced options and detailed documentation, check out the <a class=\"\" href=\"https:\/\/documentation.iqonic.design\/graphina\/php-hooks\/optimizing-element-sets-in-graphina-with-php-hooks\">official Graphina PHP Hooks guide<\/a>.<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>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: What This [&hellip;]<\/p>\n","protected":false},"author":12,"featured_media":0,"parent":631,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-633","post","type-post","status-publish","format-standard","hentry","category-graphina"],"featured_image_src":null,"author_info":{"display_name":"wordpressadminiq","author_link":"https:\/\/documentation.iqonic.design\/graphina\/author\/wordpressadminiq\/"},"children":[],"_links":{"self":[{"href":"https:\/\/documentation.iqonic.design\/graphina\/wp-json\/wp\/v2\/posts\/633","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/documentation.iqonic.design\/graphina\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/documentation.iqonic.design\/graphina\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/documentation.iqonic.design\/graphina\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/documentation.iqonic.design\/graphina\/wp-json\/wp\/v2\/comments?post=633"}],"version-history":[{"count":6,"href":"https:\/\/documentation.iqonic.design\/graphina\/wp-json\/wp\/v2\/posts\/633\/revisions"}],"predecessor-version":[{"id":648,"href":"https:\/\/documentation.iqonic.design\/graphina\/wp-json\/wp\/v2\/posts\/633\/revisions\/648"}],"up":[{"embeddable":true,"href":"https:\/\/documentation.iqonic.design\/graphina\/wp-json\/wp\/v2\/posts\/631"}],"wp:attachment":[{"href":"https:\/\/documentation.iqonic.design\/graphina\/wp-json\/wp\/v2\/media?parent=633"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/documentation.iqonic.design\/graphina\/wp-json\/wp\/v2\/categories?post=633"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/documentation.iqonic.design\/graphina\/wp-json\/wp\/v2\/tags?post=633"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}