Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Waiting for javascript chart to finish loading before take screenshoot
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
T. Ho  
View profile  
 More options Nov 12 2012, 4:19 am
From: "T. Ho" <hot...@gmail.com>
Date: Mon, 12 Nov 2012 01:19:43 -0800 (PST)
Local: Mon, Nov 12 2012 4:19 am
Subject: Waiting for javascript chart to finish loading before take screenshoot

Hello all,

In my java application I want to use CasperJS to take screenshoot of
javascript chart (on server side) then post the picture back to java
application server. And my problem is I don't know when a javascript chart
is finished to load before it executes a sreenshoot.

Here is my js:

phantom.casperPath = 'D:/Codebases/casperjs';
phantom.injectJs(phantom.casperPath + '/bin/bootstrap.js');

var casper = require('casper').create({
    verbose: true,
    logLevel: "debug"

});

casper.start(casper.cli.get(0));

casper.waitFor(function check() {
    return this.evaluate(function() {
        // what do I check here?
    });

}, function then() {

 var pic = this.captureBase64('png');

 casper.open('http://localhost:8080/stream', {
  method: 'post',
  data: {
   'stream': pic            
  }
 });

});

What do I check in side evaluate function?

Thank you in advanced
T. Ho


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nicolas Perriault  
View profile  
 More options Nov 12 2012, 4:49 am
From: Nicolas Perriault <nico...@perriault.net>
Date: Mon, 12 Nov 2012 10:49:14 +0100
Local: Mon, Nov 12 2012 4:49 am
Subject: Re: [casperjs] Waiting for javascript chart to finish loading before take screenshoot

On Mon, Nov 12, 2012 at 10:19 AM, T. Ho <hot...@gmail.com> wrote:
>         // what do I check here?

How do you you want we know that if we don't even have sample code to see? :)

++

--
Nicolas Perriault
https://nicolas.perriault.net/
Phone: +33 (0) 660 92 08 67


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
T. Ho  
View profile  
 More options Nov 12 2012, 5:05 am
From: "T. Ho" <hot...@gmail.com>
Date: Mon, 12 Nov 2012 02:05:42 -0800 (PST)
Local: Mon, Nov 12 2012 5:05 am
Subject: Re: [casperjs] Waiting for javascript chart to finish loading before take screenshoot

Hi

I have a DIV with id = "container" and here is my code inside evaluate
function:

var contain= document.getElementById ("container");
        return contain.querySelectorAll('svg').length > 2;

Thank
T. Ho


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nicolas Perriault  
View profile  
 More options Nov 12 2012, 6:23 am
From: Nicolas Perriault <nico...@perriault.net>
Date: Mon, 12 Nov 2012 12:22:18 +0100
Local: Mon, Nov 12 2012 6:22 am
Subject: Re: [casperjs] Waiting for javascript chart to finish loading before take screenshoot

On Mon, Nov 12, 2012 at 11:05 AM, T. Ho <hot...@gmail.com> wrote:
> I have a DIV with id = "container" and here is my code inside evaluate
> function:

> var contain= document.getElementById ("container");
>         return contain.querySelectorAll('svg').length > 2;

I meant the whole graphics code

++

--
Nicolas Perriault
https://nicolas.perriault.net/
Phone: +33 (0) 660 92 08 67


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
T. Ho  
View profile  
 More options Nov 12 2012, 6:30 am
From: "T. Ho" <hot...@gmail.com>
Date: Mon, 12 Nov 2012 03:30:08 -0800 (PST)
Local: Mon, Nov 12 2012 6:30 am
Subject: Re: [casperjs] Waiting for javascript chart to finish loading before take screenshoot

Hi Nicolas,

Sorry for my misunderstand, and here is my graphics code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
   <meta http-equiv="content-type" content="text/html;
charset=UTF-8;application/x-javascript"/>
   <script type="text/javascript" src="
http://code.jquery.com/jquery-1.7.2.min.js"></script>
   <script src="http://code.highcharts.com/highcharts.js"></script>
 <script src="http://code.highcharts.com/modules/exporting.js"></script>
 <script type='text/javascript'>
  $(function () {
      var chart;
      $(document).ready(function() {

          // Radialize the colors
          Highcharts.getOptions().colors =
$.map(Highcharts.getOptions().colors, function(color) {
              return {
                  radialGradient: { cx: 0.5, cy: 0.3, r: 0.7 },
                  stops: [
                      [0, color],
                      [1,
Highcharts.Color(color).brighten(-0.3).get('rgb')] // darken
                  ]
              };
          });

          // Build the chart
          chart = new Highcharts.Chart({
              chart: {
                  renderTo: 'container',
                  plotBackgroundColor: null,
                  plotBorderWidth: null,
                  plotShadow: false,
                  heigh: 400,
                  width: 600
              },
              title: {
                  text: 'Browser market shares at a specific website, 2010'
              },
              tooltip: {
                  pointFormat: '{series.name}: <b>{point.percentage}%</b>',
                  percentageDecimals: 1
              },
              plotOptions: {
                  pie: {
                      allowPointSelect: true,
                      cursor: 'pointer',
                      dataLabels: {
                          enabled: true,
                          color: '#000000',
                          connectorColor: '#000000',
                          formatter: function() {
                              return '<b>'+ this.point.name +'</b>: '+
this.percentage +' %';
                          }
                      }
                  }
              },
              series: [{
                  type: 'pie',
                  name: 'Browser share',
                  data: [
                      ['Firefox',   45.0],
                      ['IE',       26.8],
                      {
                          name: 'Chrome',
                          y: 12.8,
                          sliced: true,
                          selected: true
                      },
                      ['Safari',    8.5],
                      ['Opera',     6.2],
                      ['Others',   0.7]
                  ]
              }]
          });
      });

  });
 </script>
</head>
<body>
<div id="container" style="height: 300px"></div>
</body>
</html>
Thank
T. Ho


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »