{"id":180927,"date":"2013-05-25T21:31:03","date_gmt":"2013-05-25T17:31:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=180927"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=180927","title":{"rendered":"<span class=\"post_title\">\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435: NodeJS + D3.js + PhantomJS<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0412\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0443 \u043d\u0430\u0441 \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043f\u0440\u0438\u0445\u043e\u0442\u044c \u2014 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0438, \u0434\u0430 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0435, \u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0445\u043e\u0436\u0438\u0435 \u043d\u0430 <b>\u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0435\u0441\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435<\/b>.<br \/>  \u0414\u0430-\u0434\u0430, \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a, \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 \u0443\u0436\u0435 \u0431\u044b\u043b\u0438 \u0432\u0441\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0441\u0442\u0438, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 <a href=\"http:\/\/d3js.org\/\">d3.js<\/a>.<\/p>\n<p>  \u0414\u043b\u044f \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0431\u044b\u043b \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u00abgoogle-driven investigation\u00bb \u0438 \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u044b\u0431\u043e\u0440 \u043f\u0430\u043b \u043d\u0430 <a href=\"http:\/\/nodejs.org\">\u043d\u043e\u0434\u0443<\/a> + <a href=\"http:\/\/phantomjs.org\/\">\u0444\u0430\u043d\u0442\u043e\u043c<\/a>.<\/p>\n<p>  \u0417\u0430 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043f\u0440\u043e\u0448\u0443 \u0432 \u0433\u043b\u0443\u0431\u0438\u043d\u044b \u043f\u043e\u0441\u0442\u0430.<\/p>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u0421\u043a\u0443\u0447\u043d\u043e\u0435 \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u0420\u0430\u0441\u043a\u0430\u0436\u0443 \u0432\u043a\u0440\u0430\u0442\u0446\u0435 \u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e. \u041d\u0430\u0448\u0430 \u0444\u0438\u0440\u043c\u0430 \u043d\u0430\u0448\u043b\u0430 BigData-\u0441\u0442\u0430\u0440\u0442\u0430\u043f, \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432\u044b\u0439\u0433\u0440\u0430\u043b\u0430 \u0442\u0435\u043d\u0434\u0435\u0440 \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0432\u0447\u0435\u0442\u0432\u0435\u0440\u043e\u043c \u043f\u0438\u043b\u0438\u043c \u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0443 \u0432 \u043e\u0431\u043b\u0430\u043a\u0435 \u0434\u043b\u044f \u0442\u044f\u0436\u0435\u043b\u043e\u0432\u0435\u0441\u043d\u044b\u0445 \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u043e\u0432.<br \/>  \u041d\u0430\u0448 \u0437\u043e\u043e\u043f\u0430\u0440\u043a \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u043e\u0432 \u043d\u0430 AWS \u0441 \u0430\u0432\u0442\u043e\u0434\u0435\u043f\u043b\u043e\u0435\u043c, <a href=\"http:\/\/en.wikipedia.org\/wiki\/Scala_(programming_language)\">Scala<\/a>, <a href=\"http:\/\/spark-project.org\/\">Spark<\/a>, <a href=\"http:\/\/shark.cs.berkeley.edu\/\">Shark<\/a>, <a href=\"http:\/\/incubator.apache.org\/mesos\/\">Mesos<\/a>, NodeJS \u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u0441\u0442\u0440\u0430\u0448\u043d\u044b\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439 (\u044f \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043c\u043d\u0435 \u0438 \u043c\u043e\u0438\u043c \u043a\u043e\u043b\u043b\u0435\u0433\u0430\u043c \u0443\u0442\u043e\u043b\u0438\u0442\u044c \u0438\u043d\u0442\u0435\u043b\u043b\u0435\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0433\u043e\u043b\u043e\u0434 \u0438 \u043f\u043e\u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0430\u0440\u0443 \u0441\u0442\u0430\u0442\u0435\u0439).<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u0438\u0441\u043a\u043b\u0435\u0439\u043c\u0435\u0440<\/b><\/p>\n<div class=\"spoiler_text\">\u041d\u0430\u0448\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u2014 \u0434\u0432\u0430 \u043c\u0430\u0442\u0435\u0440\u044b\u0445 \u0434\u0436\u0430\u0432\u0438\u0441\u0442\u0430 \u0438 \u0434\u0432\u0430 \u00ab\u0430\u043c\u0431\u0438\u0434\u0435\u043a\u0441\u0442\u0440\u0430\u00bb (java\/scala + javascript). \u041c\u044b \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0441\u0435\u0431\u044f \u0445\u043e\u0440\u043e\u0448\u0438\u043c\u0438 \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u0430\u043c\u0438 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u044f\u0437\u044b\u043a\u0438 \u043a\u0430\u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u0445\u043e\u0442\u044f \u0438 \u0434\u0435\u043b\u0430\u0435\u043c \u0443\u043f\u043e\u0440 \u0432 \u0434\u0436\u0430\u0432\u0443. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0435\u0441\u043b\u0438 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043f\u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u00ab\u043d\u0435\u043f\u0440\u0430\u0432\u043e\u0441\u043b\u0430\u0432\u043d\u044b\u043c\u00bb c \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u043a, \u043f\u0440\u043e\u0448\u0443 \u0442\u0443\u0445\u043b\u044b\u0435 \u044f\u0439\u0446\u0430 \u043a\u0438\u0434\u0430\u0442\u044c \u0432 \u043b\u0438\u0447\u043a\u0443, \u0430 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432\u043d\u0443\u044e \u043a\u0440\u0438\u0442\u0438\u043a\u0443 \u2014 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438.  <\/div>\n<\/div>\n<p>  \u0423 \u043d\u0430\u0441 \u043d\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u0440\u0435\u0442\u0440\u043e\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u0430 + \u0434\u0435\u043c\u043e \u0432 \u043a\u043e\u043d\u0446\u0435 \u043d\u0435\u0434\u0435\u043b\u0438. \u042d\u0442\u043e \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0440\u044f\u0434 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u043d\u0430 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043f\u043e\u0438\u0441\u043a \u043b\u0443\u0447\u0448\u0438\u0445 \u043f\u0440\u0430\u043a\u0442\u0438\u043a.<br \/>  \u041d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0431\u044b\u043b\u0438 <a href=\"http:\/\/www.merriam-webster.com\/dictionary\/number%20cruncher\">\u00ab\u0446\u0438\u0444\u0440\u043e\u0436\u0435\u0432\u0430\u043b\u043a\u0438\u00bb<\/a> \u043d\u0430 \u0441\u043a\u0430\u043b\u0435 \u0438 \u0440\u0435\u0441\u0442-\u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043d\u0430 \u043d\u043e\u0434\u0435.<\/p>\n<h1>\u0421\u0443\u0442\u044c<\/h1>\n<p>  <\/p>\n<h2>\u0422\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f<\/h2>\n<p>  <\/p>\n<ul>\n<li>\u0413\u0440\u0430\u0444\u0438\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439<\/li>\n<li>\u0413\u0440\u0430\u0444\u0438\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u00ab\u0441\u0432\u0438\u0441\u0442\u0435\u043b\u043a\u0438\u00bb<\/li>\n<li>\u0413\u0440\u0430\u0444\u0438\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435<\/li>\n<li>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u2014 REST<\/li>\n<li>\u0412\u0441\u0435 \u0434\u0435\u043b\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u0442\u0440\u043e\u0438\u0442\u044c\u0441\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e \u0434\u0430\u0442\u0430\u0441\u0435\u0442\u0430\u043c \u0438\u0437 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430<\/li>\n<\/ul>\n<h2>\u041f\u043e\u0447\u0435\u043c\u0443 \u043d\u043e\u0434\u0430 \u0438 \u0444\u0430\u043d\u0442\u043e\u043c?<\/h2>\n<p>  \u0412 \u0445\u043e\u0434\u0435 \u0431\u0435\u0433\u043b\u043e\u0433\u043e \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0431\u044b\u043b\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043e \u0442\u0440\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430:  <\/p>\n<ol>\n<li> \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c js-\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u043e\u043c-\u0434\u0435\u0440\u0435\u0432\u0430 \u0438 Image Magic \u0434\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 SVG \u0432 PNG (\u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"http:\/\/eng.wealthfront.com\/2011\/12\/converting-dynamic-svg-to-png-with.html\">\u0431\u044b\u043b \u043d\u0430\u0439\u0434\u0435\u043d<\/a>).  <\/li>\n<li>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0436\u0430\u0432\u0430-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u0447\u0430\u0440\u0442\u043e\u0432 \u0432 \u0441\u043a\u0430\u043b\u0435 (\u0438\u043b\u0438 <a href=\"https:\/\/github.com\/wookietreiber\/scala-chart\">\u0441\u043a\u0430\u043b\u0430-\u0430\u043d\u0430\u043b\u043e\u0433\u0438<\/a>) \u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u0441\u0442\u0438\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u043f\u043e\u0434 d3  <\/li>\n<li>\u0417\u0430\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u043d\u0442\u043e\u043c \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441\u043e \u0441\u043a\u0430\u043b\u043e\u0439\/\u043d\u043e\u0434\u043e\u0439  <\/li>\n<\/ol>\n<p>  \u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u21161 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u043b \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0432\u043e\u043f\u0440\u043e\u0441 \u043e css-\u0441\u0442\u0438\u043b\u044f\u0445 \u0438 \u043e\u0431\u0449\u0435\u0439 \u0446\u0435\u043b\u0435\u0441\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e\u0441\u0442\u0438 (\u043d\u0435 \u043d\u043e\u0434\u043e\u0432\u0441\u043a\u043e\u0435 \u044d\u0442\u043e \u043f\u0440\u0438\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u0440\u0430\u0441\u0441\u0447\u0435\u0442\u0430\u043c\u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c).<br \/>  \u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u21162 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0440\u0430\u0437\u0443\u043c\u043d\u044b\u043c, \u043d\u043e \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0431\u043e\u043b\u044c \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0441\u0435\u0434\u0430\u043b\u0438\u0449\u043d\u043e\u0433\u043e \u043d\u0435\u0440\u0432\u0430.<br \/>  \u0411\u044b\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u21163.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u0438 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438, \u0447\u0442\u043e:  <\/p>\n<ul>\n<li> Scala \u0441 \u0444\u0430\u043d\u0442\u043e\u043c\u043e\u043c \u043d\u0435 \u0434\u0440\u0443\u0436\u0438\u0442. \u0418 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0430\u043f\u0438 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0444\u0430\u043d\u0442\u043e\u043c \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442.  <\/li>\n<li>\u0417\u0430\u0442\u043e \u0444\u0430\u043d\u0442\u043e\u043c \u0434\u0440\u0443\u0436\u0438\u0442 \u0441 \u043d\u043e\u0434\u043e\u0439. \u041f\u0440\u0438\u0447\u0435\u043c \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e npm-\u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u043c\u043e\u0441\u0442 \u043c\u0435\u0436\u0434\u0443 \u043d\u043e\u0434\u043e\u0439 \u0438 \u0440\u043e\u0434\u043d\u044b\u043c \u0430\u043f\u0438 \u0444\u0430\u043d\u0442\u043e\u043c\u0430.  <\/li>\n<\/ul>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0430\u043a\u043e\u0439 \u0442\u0430\u043a\u043e\u0439 \u043c\u043e\u0441\u0442?<\/b><\/p>\n<div class=\"spoiler_text\">\u042d\u0442\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c. \u0418\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0431\u044b\u043b \u0432\u044b\u0431\u0440\u0430\u043d <a href=\"https:\/\/github.com\/sgentle\/phantomjs-node\">\u043d\u0435\u0441\u0432\u0435\u0436\u0438\u0439 \u043c\u043e\u0434\u0443\u043b\u044c<\/a> \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u043d\u0442\u043e\u043c\u043e\u043c, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043d\u044b\u0440\u043d\u0443\u0442\u044c \u0441 \u0433\u043e\u043b\u043e\u0432\u043e\u0439 \u0432 \u0434\u0435\u0431\u0430\u0433 \u043c\u043e\u0434\u0443\u043b\u044f \u0438 \u0442\u0440\u043e\u043b\u043b\u0438\u043d\u0433 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430 \u043d\u0430 \u0433\u0438\u0442\u0445\u0430\u0431\u0435 \u043d\u0430 \u043f\u0440\u0435\u0434\u043c\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0441\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439. <\/p>\n<p>  \u041e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0430\u043f\u0438 \u0443 \u0444\u0430\u043d\u0442\u043e\u043c\u0430 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435\u0442. \u0414\u0430\u0436\u0435 \u0434\u043b\u044f \u043d\u043e\u0434\u044b. \u041d\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0430\u043f\u0438 <b>\u044d\u043c\u0443\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 socket.io \u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 alert&#8217;\u0430 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435, \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u0439 \u0432 \u0444\u0430\u043d\u0442\u043e\u043c\u0435.<\/b><\/p>\n<p>  \u0410\u0432\u0442\u043e\u0440\u0443 \u0443\u0432\u0430\u0436\u0443\u0445\u0430 \u0437\u0430 \u043d\u0430\u0445\u043e\u0434\u0447\u0438\u0432\u043e\u0441\u0442\u044c! <\/p>\n<p>  \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u043e\u0439:  <\/p>\n<ol>\n<li>\u0421\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c socket.io \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u0444\u0430\u043d\u0442\u043e\u043c\u0430  <\/li>\n<li>\u0421\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430-\u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0430 \u0441 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c.  <\/li>\n<li>\u041f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043b\u0443\u0448\u0430\u0442\u0435\u043b\u044c alert-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u00ab\u043e\u0442\u0432\u0435\u0442\u00bb \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043d\u0430 socket.io \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435  <\/li>\n<li>\u041d\u0430 \u043d\u043e\u0434\u0435 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f <a href=\"http:\/\/expressjs.com\/\">express<\/a>-\u0441\u0435\u0440\u0432\u0435\u0440, \u043e\u0442\u0434\u0430\u044e\u0449\u0438\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0449\u0438\u0439 socket.io \u0437\u0430\u043f\u0440\u043e\u0441\u044b.  <\/li>\n<li>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0444\u0430\u043d\u0442\u043e\u043c\u0430 \u0438 \u0435\u043c\u0443 \u0441\u043a\u0430\u0440\u043c\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430-\u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0430.  <\/li>\n<li>\u041c\u043e\u0434\u0443\u043b\u044c \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u00ab\u043e\u0442\u0437\u0435\u0440\u043a\u0430\u043b\u0435\u043d\u043d\u044b\u0439\u00bb \u0430\u043f\u0438 \u0444\u0430\u043d\u0442\u043e\u043c\u0430 (\u043d\u043e \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u043c\u0438; \u0432 \u0444\u0430\u043d\u0442\u043e\u043c\u0435 \u043e\u043d\u0438 \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b)  <\/li>\n<\/ol>\n<p>  <\/div>\n<\/div>\n<p>  \u0423\u0433\u043b\u0443\u0431\u0438\u0432\u0448\u0438\u0441\u044c \u0432 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u00ab\u0444\u0430\u043d\u0442\u043e\u043c + \u043d\u043e\u0434\u0430\u00bb, \u044f \u0432\u044b\u044f\u0441\u043d\u0438\u043b, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0439\u0441\u044f javascript-\u043a\u043e\u0434 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<br \/>  \u0424\u0430\u043d\u0442\u043e\u043c \u2014 \u044d\u0442\u043e \u0432\u0435\u0431\u043a\u0438\u0442 \u0441 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0434\u043e\u043c-\u0434\u0435\u0440\u0435\u0432\u0430, \u0441\u0442\u0438\u043b\u0435\u0439 \u0438 \u0434\u0436\u0430\u0432\u0430\u0441\u043a\u0440\u0438\u043f\u0442\u0430. \u0418 \u043e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043d\u0438\u043c\u043a\u0438 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u0422\u0430\u043a\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 <b>\u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u0438!<\/b><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0435 \u043a\u0430\u043c\u043d\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\u0412\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u043e\u0442\u0435\u0442\u044c \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0444\u0430\u043d\u0442\u043e\u043c\u0430 \u0447\u0435\u0440\u0435\u0437 \u043d\u043e\u0434\u0443. \u041f\u0435\u0440\u0432\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043f\u043b\u043e\u0445\u043e\u0432\u0430\u0442 \u0438 \u043a\u0440\u0438\u0432\u043e\u0432\u0430\u0442 (\u0441\u043c. \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u0441\u043f\u043e\u0439\u043b\u0435\u0440), \u043f\u043e\u0442\u043e\u043c\u0443 \u0432\u044b\u0431\u043e\u0440 \u043f\u0430\u043b \u043d\u0430 <a href=\"https:\/\/github.com\/alexscheelmeyer\/node-phantom\">node-phantom<\/a>.<br \/>  \u0412\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0434\u0430\u0432\u043d\u044f\u044f \u043a\u0430\u043a \u043c\u0438\u0440 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u2014 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u043e \u0430\u043f\u0438.<\/p>\n<p>  \u041c\u0435\u0442\u043e\u0434\u043e\u043c \u043d\u0430\u0443\u0447\u043d\u043e\u0433\u043e \u0442\u044b\u043a\u0430 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c, \u0447\u0442\u043e:  <\/p>\n<ul>\n<li>\u0424\u0430\u043d\u0442\u043e\u043c <b>\u0438\u043d\u0436\u0435\u043a\u0442\u0438\u0442<\/b> (<code>page.indectJs<\/code>) \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0432 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u043f\u043e\u043b\u043d\u043e\u043c\u0443 \u043f\u0443\u0442\u0438 \u043d\u0430 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435.  <\/li>\n<li>\u0424\u0430\u043d\u0442\u043e\u043c <b>\u0438\u043d\u043a\u043b\u0443\u0434\u0438\u0442<\/b> (<code>page.includeJs<\/code>) \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0432 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u043f\u043e \u043f\u043e\u043b\u043d\u043e\u043c\u0443 \u0443\u0440\u043b\u0443, \u043d\u043e \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 <b>\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e API page.includeJs \u0438\u0441\u043f\u043e\u0440\u0447\u0435\u043d<\/b> \u0438\u0437-\u0437\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.  <\/li>\n<li>\u0418\u0437-\u0437\u0430 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0437\u0432\u0435\u0437\u0434 \u043d\u0430 \u043d\u0435\u0431\u0435 \u0444\u0430\u043d\u0442\u043e\u043c <b>\u043d\u0435 \u043f\u0430\u0440\u0441\u0438\u0442 \u0441\u0442\u0438\u043b\u0438<\/b>, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0447\u0435\u0440\u0435\u0437 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 <code>&lt;link&gt;<\/code> \u043a \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0443 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b.  <\/li>\n<li>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u043d\u0443\u0442\u0440\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0444\u0430\u043d\u0442\u043e\u043c\u0430, \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c <b>\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0432 \u0441\u0442\u0440\u043e\u043a\u0443<\/b>  <\/li>\n<\/ul>\n<p>  <\/div>\n<\/div>\n<h2>\u0414\u043e\u043b\u0433\u043e\u0436\u0434\u0430\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u043c\u043e\u0434\u0443\u043b\u044c <a href=\"https:\/\/github.com\/dfilatov\/jspromise\">vow<\/a> vow \u0434\u043b\u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f <a href=\"http:\/\/en.wikipedia.org\/wiki\/Spaghetti_code\"> \u00ab\u043c\u0430\u043a\u0430\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u0438\u00bb<\/a> \u043a\u043e\u0434\u0430. <i>\u041f\u043b\u043e\u0445\u043e \u0438\u043b\u0438 \u0445\u043e\u0440\u043e\u0448\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u2014 \u043e\u0442\u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445! <\/i><\/p>\n<pre><code class=\"javascript\">\/\/ \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u043d\u0442\u043e\u043c\u043e\u043c (\u0432\u0441\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u044b \u0432 package.json) var phantom = require(&quot;node-phantom&quot;) \/\/ \u043f\u0440\u043e\u043c\u0438\u0441\u044b   , vow = require(&quot;vow&quot;) \/\/ \u043a\u043e\u043d\u0444\u0438\u0433 \u043d\u0430\u0448\u0435\u0433\u043e \u0440\u0435\u0441\u0442-\u0441\u0435\u0440\u0432\u0435\u0440\u0430   , cfg = require(&quot;..\/config&quot;) \/\/ \u0440\u043e\u0434\u043d\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439   , fs = require('fs') \/\/ \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0444\u0430\u043d\u0442\u043e\u043c\u0430   , pi;  \/\/ \u044f \u0441\u043e\u0437\u0434\u0430\u044e \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0444\u0430\u043d\u0442\u043e\u043c\u0430 \u0441\u0440\u0430\u0437\u0443 \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f exports.init = function () {   if (pi) {     pi.exit();   }   phantom.create(function (err, instance) {     pi = instance;   }); }  \/\/ \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u0435\u0440\u0433\u0430\u0435\u0442\u0441\u044f \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f - \u0442\u043e\u0447\u043a\u0430 \u0432\u0445\u043e\u0434\u0430 exports.render = function (dataset, opts) {   var promise = vow.promise();    \/\/ \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430   pi.createPage(function (err, page) {          \/\/ \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0441\u043d\u0438\u043c\u043a\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e     page.set(&quot;viewportSize&quot;, opts.viewport);      \/\/ \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u043a d3 \u043d\u0430 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 (\u0441\u043c. \u0441\u043f\u043e\u0439\u043b\u0435\u0440 &quot;\u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0435 \u043a\u0430\u043c\u043d\u0438&quot;)     var d3Path = __dirname + &quot;\/..\/client\/scripts\/vendor\/d3.v3.js&quot;;     \/\/ \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u043a \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u043c\u0443 \u0441\u043a\u0440\u0438\u043f\u0442\u0443, \u0441\u0442\u0440\u043e\u044f\u0449\u0435\u043c\u0443 \u0433\u0440\u0430\u0444\u0438\u043a \u043d\u0430 d3     \/\/ type - \u044d\u0442\u043e \u0442\u0438\u043f \u0433\u0440\u0430\u0444\u0438\u043a\u0430 (line, bar, pie)     \/\/ \u043a\u0430\u0436\u0434\u044b\u0439 \u0444\u0430\u0439\u043b chart.xxx.js \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u0435\u0442\u043e\u0434 \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0433\u0440\u0430\u0444\u0438\u043a\u0430     var chartJs = __dirname + &quot;\/..\/client\/scripts\/chart.&quot; + opts.type + &quot;.js&quot;;     \/\/ \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u043a \u0444\u0430\u0439\u043b\u0443 \u0441\u0442\u0438\u043b\u0435\u0439 \u0434\u043b\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u0430     var chartCss = __dirname + &quot;\/..\/client\/styles\/charts.css&quot;;     var innerStyle = &quot;&quot;;      \/\/ \u043d\u0430\u0448\u0430 \u043b\u043e\u0433\u0438\u043a\u0430     \/\/ \u043a\u0430\u043a \u0432\u0430\u043c \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434? \u0447\u0438\u0442\u0430\u0435\u043c? \u043e\u0442\u0437\u044b\u0432\u044b \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438     injectLib_(page, d3Path)()       .then(injectLib_(page, chartJs))       .then(readCssStyles_(chartCss))       .then(drawChart_(page, {dataset: dataset, innerCss: innerStyle}, opts))       .then(function (res) {         \/\/ \u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u043e\u043a, \u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043f\u0443\u0442\u044c \u043a \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u043e\u043c\u0443 \u0433\u0440\u0430\u0444\u0438\u043a\u0443         promise.fulfill({filename: res.filename});       })       .fail(function (err) {         promise.reject(err)       }     )   });   return promise; }  \/\/ \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0441\u0442\u0438\u043b\u0438 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u0432 \u0431\u0443\u0444\u0435\u0440 (\u0441\u0442\u0440\u043e\u043a\u0443) \/\/ \u0437\u0430\u0447\u0435\u043c \u0442\u0430\u043a - \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0432 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u0435 &quot;\u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0435 \u043a\u0430\u043c\u043d\u0438&quot; function readCssStyles_(chartCss) {   return function(){     var prom = vow.promise();     fs.readFile(chartCss, 'utf8', function (err,innerCss) {       if (err) {         console.log(chartCss + &quot;: read failed, err: &quot; + err);         prom.reject(chartCss + &quot;: read failed, err: &quot; + err);       } else {         console.log(chartCss + &quot; read&quot;);         prom.fulfill(innerCss);       }     });     return prom;   } }  function injectLib_(page, path) {   return function () {     var prom = vow.promise();      \/\/ \u044d\u0442\u043e\u0442 \u0432\u044b\u0437\u043e\u0432 \u0432\u0441\u0442\u0430\u0432\u0438\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u0432 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443, \u043d\u043e \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 \u0435\u0433\u043e \u0434\u043e \u0432\u044b\u0437\u043e\u0432\u0430 page.evaluate     page.injectJs(path, function (err) {       if (err) {         console.log(path + &quot; injection failed&quot;)         prom.reject(path + &quot; injection failed&quot;);       } else {         console.log(path + &quot; injected&quot;)         prom.fulfill();       }     });     return prom;   } }  function drawChart_(page, data, opts) {   return function (innerCss) {     data.innerCss = innerCss;     var prom = vow.promise();        \/\/ \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 \u0432\u0441\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0432 \u0444\u0430\u043d\u0442\u043e\u043c\u0435       \/\/ \u043f\u0435\u0440\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f - \u044d\u0442\u043e &quot;\u044d\u0432\u0430\u043b\u044e\u0430\u0442\u043e\u0440&quot;. \u0415\u0433\u043e \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b       \/\/ \u044d\u0432\u0430\u043b\u044e\u0430\u0442\u043e\u0440 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 \u0434\u0436\u0430\u0432\u0430\u0441\u043a\u0440\u0438\u043f\u0442\u0435, \u0430 \u043d\u0435 \u0441\u0442\u0440\u043e\u043a\u043e\u0439       page.evaluate(function (data) {                  \/\/ \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0432 \u0441\u0442\u0440\u043e\u043a\u0443         \/\/ \u044d\u0442\u043e \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441         data = JSON.parse(data);          \/\/ \u0442\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u044b\u0437\u043e\u0432 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0433\u0440\u0430\u0444\u0438\u043a\u0430         \/\/ \u044d\u0442\u043e\u0442 \u0430\u043f\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0432 charts.xxx.js         charts.line(&quot;body&quot;,data.dataset);          \/\/ \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0442\u0438\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043b\u0438 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u0441\u0442\u0438\u043b\u0435\u0439 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043b\u0438 \u0441\u0442\u0440\u043e\u043a\u043e\u0439         var style = document.createElement(&quot;style&quot;);         style.innerHTML = data.innerCss;         document.getElementsByTagName(&quot;head&quot;)[0].appendChild(style);       }       , function (err, result) {         if (err) {           prom.reject(&quot;phantomjs evaluation failed : &quot; + err)         }                   \/\/ \u0437\u0430\u0434\u0430\u0434\u0438\u043c \u043f\u0443\u0442\u044c \u0434\u043b\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043e\u0442\u0440\u0435\u043d\u0434\u0435\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u0433\u0440\u0430\u0444\u0438\u043a\u0430 \u0432 \u0444\u0430\u0439\u043b \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435         \/\/ \u0444\u0430\u043d\u0442\u043e\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 png, pdf, gif \u0438 jpeg         var filename = cfg.server.chartsPath + '\/' + opts.type + &quot;_&quot; + Date.now() + &quot;.png&quot;;         var savingPath = &quot;client&quot; + filename;          \/\/  \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443         page.render(savingPath, function (err, res) {           console.log(&quot;Saving image: &quot; + filename);           page.close();           prom.fulfill({filename: filename});         });       }, JSON.stringify(data));     return prom;   } } <\/code><\/pre>\n<div class=\"spoiler\"><b class=\"spoiler_title\">P.S<\/b><\/p>\n<div class=\"spoiler_text\">\u0412\u043e\u043f\u0440\u043e\u0441\u044b, \u043f\u043e\u0436\u0435\u043b\u0430\u043d\u0438\u044f, \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u0438\u0432 \u0438 \u0442\u0440\u043e\u043b\u043b\u0438\u043d\u0433 \u2014 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438.<br \/>  \u041e\u0448\u0438\u0431\u043a\u0438 \u0432 \u00ab\u0432\u0435\u043b\u0438\u043a\u043e\u043c \u0438 \u043c\u043e\u0433\u0443\u0447\u0435\u043c? \u2014 \u0432 \u043b\u0438\u0447\u043a\u0443.<br \/>  \u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u0443\u0441\u043b\u044b\u0448\u0430\u0442\u044c \u0432\u0430\u0448\u00bb \u043e\u0442\u0437\u044b\u0432\u044b \u043f\u043e \u0432\u0441\u0435\u043c \u0430\u0441\u043f\u0435\u043a\u0442\u0430\u043c \u2014 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u043e\u0434\u0430, \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0430\u0442\u044c\u0438, \u0441\u0442\u0438\u043b\u044c \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u044f.  <\/div>\n<\/div>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/180927\/\"> http:\/\/habrahabr.ru\/post\/180927\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0412\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0443 \u043d\u0430\u0441 \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043f\u0440\u0438\u0445\u043e\u0442\u044c \u2014 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0438, \u0434\u0430 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0435, \u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0445\u043e\u0436\u0438\u0435 \u043d\u0430 <b>\u0443\u0436\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0435\u0441\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435<\/b>.<br \/>  \u0414\u0430-\u0434\u0430, \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a, \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435 \u0443\u0436\u0435 \u0431\u044b\u043b\u0438 \u0432\u0441\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0441\u0442\u0438, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 <a href=\"http:\/\/d3js.org\/\">d3.js<\/a>.<\/p>\n<p>  \u0414\u043b\u044f \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0431\u044b\u043b \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u00abgoogle-driven investigation\u00bb \u0438 \u0432 \u043f\u0435\u0440\u0432\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u044b\u0431\u043e\u0440 \u043f\u0430\u043b \u043d\u0430 <a href=\"http:\/\/nodejs.org\">\u043d\u043e\u0434\u0443<\/a> + <a href=\"http:\/\/phantomjs.org\/\">\u0444\u0430\u043d\u0442\u043e\u043c<\/a>.<\/p>\n<p>  \u0417\u0430 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043f\u0440\u043e\u0448\u0443 \u0432 \u0433\u043b\u0443\u0431\u0438\u043d\u044b \u043f\u043e\u0441\u0442\u0430.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-180927","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/180927","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=180927"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/180927\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=180927"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=180927"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=180927"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}