Link | google_chart |
Author | Randy Phillips |
Category | Utility |
Version | 8.5.x |
License | Public Domain |
Posted | 17 Oct 2008 |
Updated | 18 Oct 2008 |
More by this author... |
The purpose of this tag is to access the most commonly used charts from Google's Chart API. It generates a URL request to Google with specified parameters and returns a chart of your data as a PNG file.
Refer to Google's Chart API for chart type codes, marker type codes, etc.
Docs @ http://code.google.com/apis/chart/
Note: This ctag does not incorporate all the chart types and features available in the API. I have only accessed the most common types of charts, i.e., bar, pie, line, etc. I thought adding the entire API would have made the tag unduly complex. I may do an advanced chart tag later.
google_chart( -title='Vertical Bar Chart', -size='475x250', -type='bvg', -legend=true, -legendPos='l', -data=map('Exp' = '40,30,20', 'Income' = '40,60,59.5', 'Debt' = '20,10,40.5'), -axis=map('x' = 'Jan,Feb,Mar', 'y' = '0,25,50,75,100', 't' = 'A,B,C', 'r' = '0,50,100'), -colors=array('666666', 'cccccc', 'cc0000'), -grid=array(25,25) ); google_chart( -title='3D Pie Chart', -size='475x250', -type='p3', -legend=true, -legendPos='r', -data=map('Exp' = '40', 'Income' = '40', 'Debt' = '20'), -colors=array('cc0000') ); google_chart( -title='Google Meter', -size='475x250', -type='gom', -data=map('Debt-O-Meter' = '45'), -colors=array('ffffff', 'cc0000') ); google_chart( -title='Line Chart', -size='475x250', -type='lc', -legend=true, -legendPos='l', -data=map('Exp' = '40,30,20', 'Income' = '40,60,59.5', 'Debt' = '20,10,40.5'), -axis=map('x' = 'Jan,Feb,Mar', 'r' = '0,25,50,75,100'), -colors=array('666666', 'cccccc', 'cc0000'), -marker='d', -markerColor='cc0000', -markerSize='12', -grid=array(0,25) ); google_chart( -title='Horizontal Stacked Bar Chart', -size='500x175', -type='bhs', -legend=true, -legendPos='t', -data=map('Exp' = '40,30,20', 'Income' = '40,60,59.5', 'Debt' = '20,10,40.5'), -axis=map('y' = 'Jan,Feb,Mar', 'x' = '0,25,50,75,100'), -colors=array('666666', 'cccccc', 'cc0000'), -grid=array(25,25) ); google_chart( -title='Basic Pie Chart', -size='475x250', -type='p', -legend=true, -legendPos='r', -data=map('Exp' = '40', 'Income' = '40', 'Debt' = '20'), -colors=array('666666', 'cccccc', 'cc0000'), );
Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
/* Author: Randy Phillips Date: 10/15/2008 Purpose: To access Google's Chart API. Refer to Google's Chart API for chart type codes, marker type codes, etc. Docs @ http://code.google.com/apis/chart/ Note: This ctag does not incorporate all the chart types and features available in the API I have only accessed the most common types of charts, bar, pie, line, etc. I felt that adding the entire API would have made the tag unduly complex for charts that may rarely be used. Examples --------------------------------------------------------------------------------------- google_chart( -title='Vertical Bar Chart', -size='475x250', -type='bvg', -legend=true, -legendPos='l', -data=map('Exp' = '40,30,20', 'Income' = '40,60,59.5', 'Debt' = '20,10,40.5'), -axis=map('x' = 'Jan,Feb,Mar', 'y' = '0,25,50,75,100', 't' = 'A,B,C', 'r' = '0,50,100'), -colors=array('666666', 'cccccc', 'cc0000'), -grid=array(25,25) ); google_chart( -title='3D Pie Chart', -size='475x250', -type='p3', -legend=true, -legendPos='r', -data=map('Exp' = '40', 'Income' = '40', 'Debt' = '20'), -colors=array('cc0000') ); google_chart( -title='Google Meter', -size='475x250', -type='gom', -data=map('Debt-O-Meter' = '45'), -colors=array('ffffff', 'cc0000') ); google_chart( -title='Line Chart', -size='475x250', -type='lc', -legend=true, -legendPos='l', -data=map('Exp' = '40,30,20', 'Income' = '40,60,59.5', 'Debt' = '20,10,40.5'), -axis=map('x' = 'Jan,Feb,Mar', 'r' = '0,25,50,75,100'), -colors=array('666666', 'cccccc', 'cc0000'), -marker='d', -markerColor='cc0000', -markerSize='12', -grid=array(0,25) ); google_chart( -title='Horizontal Stacked Bar Chart', -size='500x175', -type='bhs', -legend=true, -legendPos='t', -data=map('Exp' = '40,30,20', 'Income' = '40,60,59.5', 'Debt' = '20,10,40.5'), -axis=map('y' = 'Jan,Feb,Mar', 'x' = '0,25,50,75,100'), -colors=array('666666', 'cccccc', 'cc0000'), -grid=array(25,25) ); google_chart( -title='Basic Pie Chart', -size='475x250', -type='p', -legend=true, -legendPos='r', -data=map('Exp' = '40', 'Income' = '40', 'Debt' = '20'), -colors=array('666666', 'cccccc', 'cc0000'), ); */ define_tag( 'chart', -namespace='google_', -req='type', -req='data', -type='map', -opt='size', -opt='title', -opt='legend', -type='boolean', -opt='legendPos', -opt='colors', -type='array', -opt='grid', -type='array', -opt='axis', -type='map', -opt='marker', -opt='markerColor', -opt='markerSize', -encodenone ); !local_defined('size') ? local('size') = '250x100'; !local_defined('legend') ? local('legend') = array; !local_defined('colors') ? local('colors') = array; !local_defined('grid') ? local('grid') = array; !local_defined('title') ? local('title') = string; !local_defined('legend') ? local('legend') = false; !local_defined('legendPos') ? local('legendPos') = string; !local_defined('axis') ? local('axis') = map; !local_defined('marker') ? local('marker') = string; !local_defined('markerColor') ? local('markerColor') = 'cc0000'; !local_defined('markerSize') ? local('markerSize') = '8'; local('imgURL') = ''; return(#imgURL); /define_tag;
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft