<apex:page controller="DashPortalController" sidebar="false"> 
    <apex:pageMessages ></apex:pageMessages>
    <!-- Google API inclusion -->
    <apex:includeScript id="a" value="https://www.google.com/jsapi"; />
    
    <apex:sectionHeader title="Google Charts" subtitle="Chart 1"/>
    
    <!-- Google Charts will be drawn in this DIV -->
   
    <apex:form >
       <table align="center">
                <td><b>Date From:</b>
                <input id="t" name="datee" 
onfocus="DatePicker.pickDate(false,'t', false);"
                     size="12" tabindex="28" type="text" />
                     
                     </td><td></td>
                <td></td>
                <td></td>
                <td></td>
                <td><b>Date To:</b>
                <apex:outputText value="{0,date,dd/MM/yyyy}">
                    <apex:param value="{!NOW()}" />
                </apex:outputText></td> 
                <td><button onclick="initCharts()">Go</button></td>
               
        </table>
     </apex:form>    
    <div id="chartBlock" style="width: 500px; height: 500px;"/>
    
    <script type="text/javascript">
        
        google.load('visualization', '1', {'packages':['corechart']});
        google.setOnLoadCallback(initCharts);
   
        function initCharts() { 
        var dateFrom= $('#t').val();        
             DashPortalController.loadCustomerServiceSuccessRate(
                 dateFrom,function(result, event){
                     if (event.status && event.result) {  
                         
             // for each result, apply it to template and append generated 
markup
             // to the results table body.
            var visualization = new 
google.visualization.PieChart(document.getElementById('chartBlock'));
                       var data = new google.visualization.DataTable();
                          data.addColumn('string','Success or Failure');
                          data.addColumn('number','Percentage');
                          
                        var finalBean= result;
                           data.addRows([
                      
                      ['Service Success Rate', finalBean.totalServiceColl],
                      ['Service Failure Rate', finalBean.totalCases]]);
                    
        } else {
           alert(event.message);
        }
         
                    visualization.draw(data,{title:'Service Success 
Rate',legend : {position: 'bottom', textStyle: {color: 'blue', fontSize: 
10}}, width:window.innerWidth,vAxis:{textStyle:{color:'red', fontSize: 
15}}});
                }, {escape:true}); 
          } 
    </script>
   
</apex:page>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-visualization-api/-/SzHmC5kc6PIJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to