! Copyright (C) 2011 John Benediktsson
! See http://factorcode.org/license.txt for BSD license
-USING: accessors arrays assocs colors.hex combinators formatting
+USING: accessors arrays assocs combinators formatting
http.client images.http images.loader images.loader.private
-images.viewer kernel math math.order present sequences splitting
-urls ;
+images.viewer kernel math math.functions math.order present
+sequences splitting urls ;
IN: google.charts
<PRIVATE
+: rgba>hex ( rgba -- hex )
+ [ red>> ] [ green>> ] [ blue>> ] tri
+ [ 255 * round >integer ] tri@ "%02X%02X%02X" sprintf ;
+
: chart>url ( chart -- url )
- [ URL" http://chart.googleapis.com/chart" ] dip {
+ [ URL" http://chart.googleapis.com/chart" clone ] dip {
[ type>> "cht" set-query-param ]
[
[ width>> ] [ height>> ] bi 2dup and [