| 120 | | print $chart->render_to_file( 'filename.jpg' ); |
| | 123 | print $chart->render_to_file( filename => 'filename.png' ); |
| | 124 | |
| | 125 | =head1 METHODS |
| | 126 | |
| | 127 | =head2 new(%args) |
| | 128 | |
| | 129 | =over 4 |
| | 130 | |
| | 131 | =item type |
| | 132 | |
| | 133 | Specifies the chart type, such as line, bar, pie, etc. If given a string like |
| | 134 | 'Bar', it will instantiate an instance of Google::Chart::Type::Bar by |
| | 135 | invoking argument-less constructor. |
| | 136 | |
| | 137 | If you want to pass parameters to the constructor, either pass in an |
| | 138 | already instanstiated object, or pass in a hash, which will be coerced to |
| | 139 | the appropriate object |
| | 140 | |
| | 141 | my $chart = Google::Chart->new( |
| | 142 | type => { |
| | 143 | module => "Bar", |
| | 144 | args => { |
| | 145 | orientation => "horizontal" |
| | 146 | } |
| | 147 | } |
| | 148 | ); |
| | 149 | |
| | 150 | =item size |
| | 151 | |
| | 152 | Specifies the chart size. Strings like "400x300", hash references, or already |
| | 153 | instantiated objects can be used: |
| | 154 | |
| | 155 | my $chart = Google::Chart->new( |
| | 156 | size => "400x300", |
| | 157 | ); |
| | 158 | |
| | 159 | my $chart = Google::Chart->new( |
| | 160 | size => { |
| | 161 | width => 400, |
| | 162 | height => 300 |
| | 163 | } |
| | 164 | ); |
| | 165 | |
| | 166 | =back |
| | 167 | |
| | 168 | =head2 as_uri() |
| | 169 | |
| | 170 | Returns the URI that represents the chart object. |
| | 171 | |
| | 172 | =head2 render() |
| | 173 | |
| | 174 | Generates the chart image, and returns the contents. |
| | 175 | |
| | 176 | =head2 render_to_file( %args ) |
| | 177 | |
| | 178 | Generates the chart, and writes the contents out to the file specified by |
| | 179 | `filename' parameter |