2014-11-01Hubot を使ってグラフ画像を生成するスクリプトを作ってみました。Heroku + PhantomJS + Chart.js で動きます。PhantomJS + Chart.js => PNG 画像化ざっくりと動作内容をまとめると子プロセスを生成し、PhantomJS を起動PhantomJS でHTML ドキュメント (canvas) を生成Chart.js を使って canvas 内でグラフを描画グラフのレンダリング完了後 (onAnimationComplete) に画像化/tmp ディレクトリにグラフ画像を保存 (Heroku の制約)robot.router を使って /tmp 内の画像URL を発行PhantomJS で処理しているスクリプトは module/phantomjs-script.coffee です。インストールnpm では配布していないので、