Hi  Ian,

The nodejs server solution is great.

Regarding quick chart, I think it's paid one and for free version it has
validity of time of 3 days of images in their server.

Thanks & Regards
Sreeram Krishnan

On Thu, Oct 15, 2020 at 6:13 AM Ian Webster <typ...@gmail.com> wrote:

> I had this problem and built a server-side renderer for Google Charts.  It
> is open-source <https://github.com/typpo/google-charts-node> and you can
> host it yourself.
>
> If you are not able to run your own Node server, you can use the publicly
> hosted web endpoint, https://quickchart.io/google-charts/render.  This
> URL accepts a *code* parameter that runs your code in a Google Charts
> environment.
>
> For example, take your drawChart function and add it to the URL:
>
> *https://quickchart.io/google-charts/render?packages=timeline&code=*
> var%20container%20=%20document.getElementById(%27timeline%27);var%20chart%20=%20new%20google.visualization.Timeline(container);var%20dataTable%20=%20new%20google.visualization.DataTable();dataTable.addColumn({%20type:%20%27string%27,%20id:%20%27President%27%20});dataTable.addColumn({%20type:%20%27date%27,%20id:%20%27Start%27%20});dataTable.addColumn({%20type:%20%27date%27,%20id:%20%27End%27%20});dataTable.addRows([[%20%27Washington%27,%20new%20Date(1789,%203,%2030),%20new%20Date(1797,%202,%204)%20],[%20%27Adams%27,%20%20%20%20%20%20new%20Date(1797,%202,%204),%20%20new%20Date(1801,%202,%204)%20],[%20%27Jefferson%27,%20%20new%20Date(1801,%202,%204),%20%20new%20Date(1809,%202,%204)%20]]);chart.draw(dataTable);
> <https://quickchart.io/google-charts/render?packages=timeline&code=var%20container%20=%20document.getElementById(%27timeline%27);var%20chart%20=%20new%20google.visualization.Timeline(container);var%20dataTable%20=%20new%20google.visualization.DataTable();dataTable.addColumn(%7B%20type:%20%27string%27,%20id:%20%27President%27%20%7D);dataTable.addColumn(%7B%20type:%20%27date%27,%20id:%20%27Start%27%20%7D);dataTable.addColumn(%7B%20type:%20%27date%27,%20id:%20%27End%27%20%7D);dataTable.addRows([[%20%27Washington%27,%20new%20Date(1789,%203,%2030),%20new%20Date(1797,%202,%204)%20],[%20%27Adams%27,%20%20%20%20%20%20new%20Date(1797,%202,%204),%20%20new%20Date(1801,%202,%204)%20],[%20%27Jefferson%27,%20%20new%20Date(1801,%202,%204),%20%20new%20Date(1809,%202,%204)%20]]);chart.draw(dataTable);>
>
> It looks messy but it works.  Don't forget to URL encode your drawChart
> Javascript.
>
> Endpoint (GET/POST): https://quickchart.io/google-charts/render
> Parameters:
>
>    - *code: *Javascript contents of drawChart (required)
>    - *packages:* Comma-separated list of Google Visualization packages to
>    load (defaults to "corechart")
>    - *width*: Width of chart canvas in pixels
>    - *height*: Height of chart canvas in pixels
>    - *mapsApiKey*:  Maps key for geochart and maps
>
> For more complex charts, I recommend POSTing your parameters as JSON.
>
> Another example:
> https://quickchart.io/google-charts/render?packages=orgchart&code=var%20data%20%3D...
> <https://quickchart.io/google-charts/render?packages=orgchart&code=var%20data%20%3D%20new%20google.visualization.DataTable%28%29%3B%0A%20%20%20%20%20%20%20%20data.addColumn%28%27string%27%2C%20%27Name%27%29%3B%0A%20%20%20%20%20%20%20%20data.addColumn%28%27string%27%2C%20%27Manager%27%29%3B%0A%20%20%20%20%20%20%20%20data.addColumn%28%27string%27%2C%20%27ToolTip%27%29%3B%0A%0A%20%20%20%20%20%20%20%20%2F%2F%20For%20each%20orgchart%20box%2C%20provide%20the%20name%2C%20manager%2C%20and%20tooltip%20to%20show.%0A%20%20%20%20%20%20%20%20data.addRows%28%5B%0A%20%20%20%20%20%20%20%20%20%20%5B%7B%27v%27%3A%27Mike%27%2C%20%27f%27%3A%27Mike%3Cdiv%20style%3D%22color%3Ared%3B%20font-style%3Aitalic%22%3EPresident%3C%2Fdiv%3E%27%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%27%27%2C%20%27The%20President%27%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%5B%7B%27v%27%3A%27Jim%27%2C%20%27f%27%3A%27Jim%3Cdiv%20style%3D%22color%3Ared%3B%20font-style%3Aitalic%22%3EVice%20President%3C%2Fdiv%3E%27%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%27Mike%27%2C%20%27VP%27%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%5B%27Alice%27%2C%20%27Mike%27%2C%20%27%27%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%5B%27Bob%27%2C%20%27Jim%27%2C%20%27Bob%20Sponge%27%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%5B%27Carol%27%2C%20%27Bob%27%2C%20%27%27%5D%0A%20%20%20%20%20%20%20%20%5D%29%3B%0A%0A%20%20%20%20%20%20%20%20%2F%2F%20Create%20the%20chart.%0A%20%20%20%20%20%20%20%20var%20chart%20%3D%20new%20google.visualization.OrgChart%28document.getElementById%28%27chart_div%27%29%29%3B%0A%20%20%20%20%20%20%20%20%2F%2F%20Draw%20the%20chart%2C%20setting%20the%20allowHtml%20option%20to%20true%20for%20the%20tooltips.%0A%20%20%20%20%20%20%20%20chart.draw%28data%2C%20%7B%27allowHtml%27%3Atrue%7D%29%3B>
>
> Documentation:
> https://quickchart.io/documentation/google-charts-image-server/
>
> Hope this helps,
>
> Ian
>
> On Tuesday, October 13, 2020 at 11:35:10 PM UTC-7 sreeram.k...@gmail.com
> wrote:
>
>> Hi All,
>>
>> I need to send google charts to my emaill body, however my charts view is
>> called via cron in codeigniter PHP and then the contents are rendered in
>> backend and then passed directly for mailing.
>>
>> I am unable to even capture image using getImageUri of google chart, as
>> it is not rendered in UI/browser and passed directly to mail.
>>
>> Can anybody suggest me how to do pass the same in mail.
>>
>> Thanks & Regards
>> Sreeram Krishnan
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Google Visualization API" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/google-visualization-api/J4LIqJtEXqs/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> google-visualization-api+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-visualization-api/3e017649-849a-44e9-bbf7-7627ef6b69afn%40googlegroups.com
> <https://groups.google.com/d/msgid/google-visualization-api/3e017649-849a-44e9-bbf7-7627ef6b69afn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-visualization-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/CAL9Mg7hCD3yoctcCZ9cOB2MJzjP%3DCP%3Dew80ymvFjN2rZJ5iROw%40mail.gmail.com.

Reply via email to