You must also change your google.load and google.setOnLoadCallback calls to
google.charts.load and google.charts.setOnLoadCallback.  Check the updating
instructions again.

On Wed, Aug 2, 2017 at 9:57 AM, 'Craig' via Google Visualization API <
[email protected]> wrote:

> Thanks for responding sir.  It still does not work.  Its probably me.    I
> have a demo of an app that this is embedded in and I need to get it to
> work.   I appreciate your help.   What I just tried follows.
>
> $progstr = "<html>
>                  <head>
>                    <script type='text/javascript' src='
> https://www.gstatic.com/charts/loader.js'></script>
>
>                    <script type='text/javascript'>
>                      google.load('current', {'packages':['
> annotatedtimeline']});
>
>                      google.setOnLoadCallback(drawChart);
>
>                      function drawChart() {
>                        var data = new google.visualization.DataTable();
>
>                        data.addColumn('date', 'Date');
>                        data.addColumn('number', '$iname');
>                        data.addColumn('string', 'title1');
>                        data.addColumn('string', 'text1');";
>
>    $progstr .= "\n                       data.addRows([";
>
>
>    # Do middle section.
>
>    $max = -10000000;
>    $min = 10000000;
>    $data = '';
>    $i = 0;
>    $j = 0;
>    foreach $perln (@perdata) { # Load behavior/performance data.
>       if ($oemind ne 'm') {
>         ($yr, $state, $stride, $invest, $dem) = split (':',$perln);
>       } else {
>            if ($i == 0) {
>              $i = 1;
>              next;
>            }
>            ($yr, $valx, $ratx, $state, $stride, $wtdstri) = split
> (':',$perln);
>          }
>
>       if ($oemind eq 'o' || $oemind eq 'e') {
>         if ($ditem == 1) {
>           $data = $state;
>         } elsif ($ditem == 2) {
>             $data = $stride;
>           } else {
>               $data = $invest;
>             }
>       } else {
>           if ($ditem == 1) {
>             $data = $valx;
>           } elsif ($ditem == 2) {
>               $data = $ratx;
>             } elsif ($ditem == 3) {
>                 $data = $state;
>               } elsif ($ditem == 4) {
>                   $data = $stride;
>                 } else {
>                     $data = $wtdstri;
>                   }
>         } # Measure.
>
>       if ( (($oemind eq 'o' || $oemind eq 'e') && $ditem < 3) || ($oemind
> eq 'm' && $ditem > 2) ) {
>         $data = 100 * $data;
>         $data = sprintf("%.1f",$data);
>       }
>
>       # Need to set range for stride, investment, and wt stride.
>
>       if ( (($oemind eq 'o' || $oemind eq 'e') && $ditem > 1) || ($oemind
> eq 'm' && $ditem > 3) ) {
>         if ($data > $max) {
>           $max = $data;
>         }
>         if ($data < $min) {
>           $min = $data;
>         }
>       }
>
>
>       $datex = $yr . ',6,1';
>
>
>       $progstrs{$datex} = '                         [new Date(' . $yr .
> ',6,1), '; # Month indicator seems to begin with 0 in the Google API
> example.
>       $progstrs{$datex} .= $data . ', undefined, undefined],';
>
>       if ($j == 0) { # Get first performance indicator value for below.
>         $defrst = $data;
>         $j = 1;
>       }
>
>       # Save this part to add to any marks below - same year = same values.
>
>       $progstrs2{$datex} = $data . ', undefined,
> undefined';
>    }
>    $progstrs{$datex} = 
> substr($progstrs{$datex},0,length($progstrs{$datex})-1);
> # Get rid of last comma.
>
>
>    if ( (($oemind eq 'o' || $oemind eq 'e') && $ditem == 1) || ($oemind eq
> 'm' && $ditem == 3) ) { # State range.
>      $max = 100;
>    }
>
>    $j = 0;
>    foreach $tln (@tlnmrks) { # Interrogate marks and integrate the mark
> into the timeline.
>
>      if (index(lc($tln),'analysis:') > -1) {
>        last;
>      }
>
>      ($datex,$titlex,$textx) = split (':',$tln);
>      $datex =~ tr/ //ds; # Eliminate spaces.
>
>      $i = 0; # New date indicator.
>      if (index($datex,',') > -1) { # Date of mark includes month and day
> -> new entry.
>        ($yr,$mn,$da) = split (',',$datex);
>        $mn = $mn - 1; # Month adjustment.
>        $datex = $yr . ',' . $mn . ',' . $da;
>        $i = 1;
>      } else {
>          $yr = $datex; # Marker date is an existing data year.
>          $datex = $yr . ',6,1';
>        }
>
>      $odatex = $yr . ',6,1'; # Date of existing behavior/performance
> record.
>
>      # Add mark information to the right line.
>
>      @sstrs = ();
>      if (exists $progstrs2{$odatex}) {
>        @sstrs = split (',', $progstrs2{$odatex});
>      } else {
>          if ($j) {
>            $sstrs[0] = $delast; # Been through once - take previous value.
>          } else {
>              $sstrs[0] = $defrst; # First time through - take first above.
>            }
>        }
>
>      $sstrs[1] = "'" . $titlex . "'";
>      $sstrs[2] = "'" . $textx . "'";
>
>      $progstrs2{$datex} = join (',', @sstrs);
>
>      # Dates are the same for an existing year.
>
>      $progstrs{$datex} = '                         [new Date(' . $datex .
> '), ' . $progstrs2{$datex} . '],';
>
>      $delast = $sstrs[0]; # Save last performance indicator value.
>
>      $j = 1; # Been through once.
>    }
>
>
>    # Sort the hash by the index into an array and add it to the program
> str.
>
>    foreach $key (sort (keys(%progstrs))) {
>      $progstr .= $progstrs{$key};
>    }
>    $progstr = substr($progstr,0,length($progstr)-1) . ']'; # Get rid of
> last comma.
>
>
>    # Add the last part.
>
>    my @colors = ();
>    $colors[0] = "#$banrcolr";
>
>
>    $progstr .= "        ]);
>
>                        var chart = new google.visualization.
> AnnotatedTimeLine(document.getElementById('chart_div'));
>
>                        chart.draw(data, {displayAnnotations: true,
> displayZoomButtons: false, allValuesSuffix: '$suf', fill: 40, thickness: 1,
> colors: ".@colors.", displayRangeSelector: false});
>                      }
>                      </script>
>                    </head>
>                    <body>
>
>                      <div id='chart_div' style='width: 800px; height:
> 380px;'></div>
>
>                    </body>
>                </html>";
>
>>
>> --
> 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 [email protected].
> To post to this group, send email to google-visualization-api@
> googlegroups.com.
> Visit this group at https://groups.google.com/
> group/google-visualization-api.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/google-visualization-api/48d57210-5f1c-4bfe-b4d5-
> f2d2eb456687%40googlegroups.com
> <https://groups.google.com/d/msgid/google-visualization-api/48d57210-5f1c-4bfe-b4d5-f2d2eb456687%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
[email protected] <[email protected]>   5CC, Cambridge MA

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJPLdzmBcXDxa0SDB9k%3DcLH3kK%3DpvgQnJL7QGq%3DPfDeT4g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to