This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Aug 19, 2018, 1:09 PM
41 Posts

Google Chart API

  • Category: APIs
  • Platform: All
  • Release: 9.0.1
  • Role: Developer
  • Tags: Google Chart API
  • Replies: 0

Hi All,

Good day to you! 

We have tried to bind the Google Chart API with IBM X-Pages web-based application, but unable view the expected results in Google Chart.

We have taken input field and set the default values which have given in one of Google Chart API Examples. We are trying to take the values from JavaScript eg: document.getElementById("#{id:txtValues}").value, but not able to fetch the data.

However, when same details, we tried to put on Click Button and prompted the alert values, it shows data correctly. Whereas, while using the script we are getting issues with No Data in Chart.

Is there any possibility, we can get some assistance from your team member to advise us on this above query. 

***************

Below is code sample from X Pages.

 

<?xml version="1.0" encoding="UTF-8"?>

<xp:view xmlns:xp="http://www.ibm.com/xsp/core">

<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>

<xp:inputText id="txtValues">

           <xp:this.defaultValue><![CDATA[#{javascript:"['Opportunity Details', 'Total Values'],['Work',    21],['Eat',      12],['Commute',  22],['Watch TV', 32],['Sleep',    57]"}]]></xp:this.defaultValue>

       </xp:inputText>

 

<div id="piechart" style="width: 900px; height: 500px;"></div>

<script type='text/javascript' src='https://www.google.com/jsapi'></script> 

<script>   

   google.charts.load('current', {'packages':['corechart']});

   google.charts.setOnLoadCallback(drawChart);

    function drawChart() {

        var data = google.visualization.arrayToDataTable([    

    

       document.getElementById("#{id:txtValues}").value

          

          

        ]);

 

        var options = {

          title: 'Opportunity Details'

        };

 

        var chart = new google.visualization.PieChart(document.getElementById('piechart'));

 

        chart.draw(data, options);

      }

      

      </script>

 

</xp:view>

 


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal