MaxiChart allows you to filter entries based on several criteria, but did you know you can choose whether to filter by all (default) or any of these ? Here is an example. Please refer to GF API doc to understand what occurs behind the scene.
AND
Here we are looking for charting all entries where the number field (id 3) is set to 1 AND text field with id 1 is set to “test”.
Shortcode
[gfchartsreports color_set="blue" float="true" include="1" type="bar" height="400px" chart_js_options="title: {display: true, text: 'TEST AND'}" custom_search_criteria='{"status":"active","field_filters":{"mode":"and","0":{"key":"3","value":"2"},"1":{"key":"1","value":"test"}}}' ]
AND Result
ANY
Here we are looking for charting all entries where the number field (id 3) is set to 1 OR – so ANY of the conditions (in field_filters) listed – text field with id 1 is set to “test”. It is then logical that there are more results in this second case.
Shortcode
[gfchartsreports color_set="blue" float="true" include="1" type="bar" height="400px" chart_js_options="title: {display: true, text: 'TEST ANY'}" custom_search_criteria='{"status":"active","field_filters":{"mode":"any","0":{"key":"3","value":"1"},"1":{"key":"1","value":"test"}}}' ]
AND Result
Field filters and conditions IDs
The more the condition you have, the more you have to increment the number of the condition, in red bold here:
"field_filters":{"mode":"any","0":{"key":"3","value":"1"},"1":{"key":"1","value":"test"}}