Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function chart_shortcode( $atts ) {
- extract(shortcode_atts(array(
- 'data' => '',
- 'colors' => '',
- 'size' => '400x200',
- 'bg' => 'ffffff',
- 'title' => '',
- 'labels' => '',
- 'advanced' => '',
- 'type' => 'pie'
- ), $atts));
- switch ($type) {
- case 'line' :
- $charttype = 'lc'; break;
- case 'xyline' :
- $charttype = 'lxy'; break;
- case 'sparkline' :
- $charttype = 'ls'; break;
- case 'meter' :
- $charttype = 'gom'; break;
- case 'scatter' :
- $charttype = 's'; break;
- case 'venn' :
- $charttype = 'v'; break;
- case 'pie' :
- $charttype = 'p3'; break;
- case 'pie2d' :
- $charttype = 'p'; break;
- default :
- $charttype = $type;
- break;
- }
- if ($title) $string .= '&chtt='.$title.'';
- if ($labels) $string .= '&chl='.$labels.'';
- if ($colors) $string .= '&chco='.$colors.'';
- $string .= '&chs='.$size.'';
- $string .= '&chd=t:'.$data.'';
- $string .= '&chf='.$bg.'';
- return '<img title="'.$title.'" src="http://chart.apis.google.com/chart?cht='.$charttype.''.$string.$advanced.'" alt="'.$title.'" />';
- }
- add_shortcode('chart', 'chart_shortcode');
Add Comment
Please, Sign In to add comment