I don't know what your server-side code does to handle this on the back 
end, but I suspect that the problem is that you are only passing one name 
(whichever is the last in the result array) to the server-side CSV script.

On Monday, September 24, 2012 12:38:01 AM UTC-4, nishh wrote:
>
> i have created an export to csv file in google charts but the problem is 
> it is showing me 1 value instead of all the value which are coming in 
> arraylist.
>
> <apex:page controller="WasteSplit" sidebar="false"> 
>     <!-- Google API inclusion -->
>     <apex:includeScript id="a" value="https://www.google.com/jsapi"; />
>     <apex:sectionHeader title="Google Charts" subtitle="Chart 2"/>
>     
>     <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="date" />
>             </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><input type="button" onclick="initCharts()" 
> value="Go"></input></td>
>             *<td><input id="exportCSV" type="button" onclick="
> window.open('/apex/CSVWasteSplit?name=' + Name + '&type=' + Type);" 
> value="Export to CSV" style="display: none;"></input></td>*
>         </table>
>      </apex:form>
>     <div id="chartBlock" style="width: 600px; height: 500px;"/>
>     
>     <script type="text/javascript">   
>         // Load the Visualization API and the piechart package.
>         google.load('visualization', '1', {'packages':['corechart']});
>         // Set a callback to run when the Google Visualization API is 
> loaded.
>         google.setOnLoadCallback(initCharts);
>      
>       
>         function initCharts() {
>             var dateFrom= $('#t').val();
>             document.getElementById('chartBlock').innerHTML = ''; 
>             document.getElementById('exportCSV').style.display = 'none'; 
>             Name = '';
>             Type = '';     
>             if(dateFrom != null && dateFrom != '')
>             {
>                 WasteSplit.WasteSource(
>                    dateFrom,function(result, event){
>                      // load Column chart
>                    if (event.status && event.result) 
>                    {
>                        var visualization = new 
> google.visualization.PieChart(document.getElementById('chartBlock'));
>                        // Prepare table model for chart with columns
>                        var data = new google.visualization.DataTable();
>                            data.addColumn('string', 'Waste Name');
>                            data.addColumn('number', 'Waste Type');
>                           
>                            // add rows from the remoting results
>                        for(var i=0; i<result.length;i++){
>                           * var finalBean= result[i];*
>                           
>  data.addRow([finalBean.WasteName,finalBean.wastetype]);
>                        }
> *//here m passing the the value of array list for exporting it to csv*
>                        *if(finalBean.WasteName != null && 
> finalBean.wastetype != null)*
> *                       {*
> *                         Name = finalBean.WasteName;*
> *                         Type = finalBean.wastetype;*
> *                        
>  document.getElementById('exportCSV').style.display = 'block'; *
> *                       }*
>                           
>                     } else {
>                            alert(event.message);
>                     }       
>                          
>                           visualization.draw(data,{title:'Waste Service 
> Split at Source',legend : {position: 'bottom', textStyle: {color: 'blue', 
> fontSize: 10}}, width:window.innerWidth,vAxis:{textStyle:{color:'red', 
> fontSize: 15}},hAxis:{title: 'Record Count',textStyle:{fontSize: 
> 10},showTextEvery:1,slantedText:true}} );
>                 }, {escape:true});
>             }             
>         }
>     </script> 
> </apex:page>
>
>
>
> the values are 
>
>
> *waste name*          *waste Type*
>
> General                    35
>
> Dry Mixed                  20
>
> No waste                  1
>
> cardboard                56
>
>  
>
> must be like this when exporting
>
>  
>
> but it is showing only 1 value
>
> *Waste Name              Waste Type*
>
> No Waste                         1
>
>
>
> can anyone help me in that
>

-- 
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/-/UbEFzOGFvP8J.
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