Is there a way to implement Google Graph in a ACF field?
https://google-developers.appspot.com/chart/interactive/docs/gallery/piechart
This is the code I need to use.
You would need to get the values of the ACF fields and set those values in the script. Here is a simple example using part of the snippet from the link you provided
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Task', '<?php the_field('hours_per_day); ?>'],
['Work', <?php the_field('work')],
// etc....
]);
var options = {
title: '<?php the_field('title'); ?>'
};
var chart = new google.visualization.PieChart(document.getElementById('piechart'));
chart.draw(data, options);
}
Forgive me, I see that my question is unclear.
I need to show a Google Graph using ACF. So if I have a Google Graph code, what custom field do I need to select so that someone can place the code in there and have it show up?
I would use a textarea field and set it to “No Formatting”.
Hi, this topic is quite interesting. But do you have any idea on how to retrieve all infos sharing the same meta-key to generate a pie chart?