Skip to content

Instantly share code, notes, and snippets.

@Godoy
Created August 14, 2013 19:55
Show Gist options
  • Select an option

  • Save Godoy/6234925 to your computer and use it in GitHub Desktop.

Select an option

Save Godoy/6234925 to your computer and use it in GitHub Desktop.
Correção de posicionamento do gráfico para o plugin de Wordpress Iced Visualization Charts
<?php
function iced_chart_display($atts, $content = null)
{
global $chart_id;
wp_enqueue_script('google-visualization', 'http://www.google.com/jsapi', array('jquery'), '1.0', true);
wp_enqueue_script('iced-visualization', plugins_url('iced-visualization.js', __FILE__), array('google-visualization'), '1.0', true);
$type = $atts['type'];
$chartReturn = '
<div id="chart_div_'.$chart_id.'"></div>
<script type="text/javascript">
var chart_id = '.$chart_id. ';
if (typeof(iced_chart_options) == "undefined"){ var iced_chart_options = new Array()};
if (typeof(iced_chart_content) == "undefined"){ var iced_chart_content = new Array()};
if (typeof(iced_chart_type) == "undefined"){ var iced_chart_type = new Array()};
iced_chart_options[chart_id] = {
width: 500, height: 350,
animation:{ duration: 2000, easing: "out" },
};
iced_chart_content[chart_id] = ['.str_replace(array('<br/>', '<br />'), '', $content).'];
iced_chart_type[chart_id] = "'.$type.'";
</script>';
$chart_id ++;
return $chartReturn;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment