Guest User

pagina: BAC41_grafico_listagem.asp

a guest
Mar 11th, 2010
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASP 9.83 KB | None | 0 0
  1. <% Response.Buffer = True %>
  2. <!-----#include file="includes/SmartSourceP.asp"-->
  3. <!-----#include file="includes/SmartSourceS_v01.asp"---------------->
  4. <!-----#include file="includes/SmartSourceR_v04.asp"--------------->
  5. <!-----#INCLUDE FILE="includes/FusionCharts.asp"--------------->
  6.  
  7. <html>
  8. <head>
  9. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  10. <title>Gráfico</title>
  11. <style type="text/css">
  12. <!--
  13. .titulo {color: #FFFFFF; font-family:"Trebuchet MS", Tahoma, Verdana; font-size:11px}
  14. .tituloCampo {color: #000000; font-family:"Trebuchet MS", Tahoma, Verdana; font-size:11px}
  15. .Valor {color: #000000; font-family:"Trebuchet MS", Tahoma, Verdana; font-size:12px}
  16. .botao {
  17.     color: #FFFFFF;
  18.     font-family:"Trebuchet MS", Tahoma, Verdana;
  19.     font-size:11px;
  20.     background-color: #333333;
  21.     border-top-width: 1px;
  22.     border-right-width: 1px;
  23.     border-bottom-width: 1px;
  24.     border-left-width: 1px;
  25.     border-top-style: inset;
  26.     border-right-style: inset;
  27.     border-bottom-style: inset;
  28.     border-left-style: inset;
  29. }
  30. -->
  31. </style>
  32. <script src="includes/FusionCharts.js" type="text/javascript"></script>
  33. <script src="includes/FusionChartsExportComponent.js" type="text/javascript"></script>
  34.  
  35. <script>
  36. //This event is raised when the chart has finished capture phase and passed the data to
  37. //Export Component for further processing
  38. function FC_ExportReady(DOMId)
  39. {
  40.     var myExportComponent = new FusionChartsExportObject("fcExporter1", "includes/Charts/FCExporter.swf");
  41.      
  42.     //------ Export Component Attributes ------//
  43.     //Set saving mode as individual. This allows users to download individual charts.
  44.     myExportComponent.componentAttributes.saveMode='individual';
  45.     //Show allowed export format drop-down
  46.     myExportComponent.componentAttributes.showAllowedTypes = '1';
  47.     //Cosmetics
  48.     //Width and height
  49.     myExportComponent.componentAttributes.width = '200';
  50.     myExportComponent.componentAttributes.height = '100';
  51.     //Message - caption of export component
  52.     //Render the exporter SWF in our DIV fcexpDiv
  53.     myExportComponent.Render("fcExportDiv");
  54.    
  55.    
  56.     var myExportComponent2 = new FusionChartsExportObject("fcExporter2", "includes/Charts/FCExporter.swf");
  57.      
  58.     //------ Export Component Attributes ------//
  59.     //Set saving mode as individual. This allows users to download individual charts.
  60.     myExportComponent2.componentAttributes.saveMode='individual';
  61.     //Show allowed export format drop-down
  62.     myExportComponent2.componentAttributes.showAllowedTypes = '1';
  63.     //Cosmetics
  64.     //Width and height
  65.     myExportComponent2.componentAttributes.width = '200';
  66.     myExportComponent2.componentAttributes.height = '100';
  67.     //Message - caption of export component
  68.     //Render the exporter SWF in our DIV fcexpDiv
  69.     myExportComponent2.Render("fcExportDiv2");
  70. }
  71.  
  72.  
  73. function exportHandler()
  74. {
  75.     var n = document.getElementById('fcExportDiv');
  76.     n.innerHTML = "&nbsp;";
  77.  
  78.     //Get reference to chart.
  79.     var chart = getChartFromId("FactorySum");
  80.     var chart2 = getChartFromId("FactorySum2");
  81.     //Now, we proceed with exporting only if chart has finished rendering.
  82.     //We do not check rendering of export component, as FusionCharts Export Object JS
  83.     //has a built-in queue that stacks up the export request until the component is ready.
  84.     if (chart.hasRendered()==true){
  85.         chart.exportChart();
  86.         //fcExportDiv
  87.     }else{
  88.         //alert("Please wait for the chart to finish rendering before you can invoke exporting");
  89.         alert("Por favor, aguarde o processamento gráfico para terminar antes que você pode chamar exportadores");
  90.     }
  91.    
  92.     if (chart2.hasRendered()==true){
  93.         chart2.exportChart();
  94.         //fcExportDiv
  95.     }else{
  96.         //alert("Please wait for the chart to finish rendering before you can invoke exporting");
  97.         alert("Por favor, aguarde o processamento gráfico para terminar antes que você pode chamar exportadores");
  98.     }
  99. }
  100. </script>
  101.  
  102.  
  103. <script>
  104. //windowWidth=768;
  105. windowWidth=800;
  106. windowHeight=550;
  107. if (parseInt(navigator.appVersion) >= 4) window.moveTo((screen.width/2)-(windowWidth/2+10),(screen.height/2)-(windowHeight/2+20));
  108. //if (parseInt(navigator.appVersion) >= 4) window.moveTo(0,0);
  109. </script>
  110.  
  111. </head>
  112.  
  113. <body>
  114.    <%  
  115.    'Response.Write(Session("gpSQL1"))
  116.    vtQuery = Split(Session("gpSQL1"),"from")
  117.  
  118.    
  119.    ''strQueryMidia = "SELECT nomecliente, midia, tipo_medida, sum(qtd) as qtd, sum(qtd_negativa) as qtd_negativa, sum(qtd_neutra) as qtd_neutra, sum(tempo) as tempo, sum(tempo_negativo) as tempo_negativo, sum(tempo_neutra) as tempo_neutra  FROM usr_view_insercao WHERE nomecliente='CEG' AND dia1>='2009.01.01' AND dia1>='2009.01.01' AND midia='TV' AND codConcorrente = 0 group by midia, nomecliente, tipo_medida"
  120.    
  121.    '#################################   PRIMEIRO GRÁFICO   #################################
  122.    strQueryMidia = "SELECT nomecliente, midia, tipo_medida, sum(qtd) as qtd, sum(qtd_negativa) as qtd_negativa, sum(qtd_neutra) as qtd_neutra, sum(tempo) as tempo, sum(tempo_negativo) as tempo_negativo, sum(tempo_neutra) as tempo_neutra  FROM "& vtQuery(1) & " group by midia, nomecliente, tipo_medida"
  123.    
  124.     Set rs_midia = gpExecuteSQL(strQueryMidia)
  125.    
  126.    'strXML será usado para armazenar todo o documento XML gerado
  127.    'Gerando o elemento grafico
  128.    strXML = "<?xml version='1.0' encoding='UTF-8'?><graph baseFontSize='12' caption='"& rs_midia("nomecliente") &"' subCaption='"& rs_midia("midia") &"' bgColor='FFFFFF' decimalPrecision='0' showPercentageValues='1' showNames='1' numberPrefix='' showValues='1' showPercentageInLabel='1' pieYScale='60' pieBorderAlpha='50' pieFillAlpha='70' pieSliceDepth='40' pieRadius='150' exportEnabled='1' exportAtClient='1' exportHandler='fcExporter1'>"
  129.  
  130.  If Not rs_midia.eof Then  
  131.     While Not rs_midia.Eof
  132.       If rs_midia.fields("tipo_medida") <> "TEMPO" then
  133.           'strXML = strXML & "<set name='" & rs_midia("qtd") & "' value='" & rs_midia("qtd_negativa") & "' />"
  134.           strXML = strXML & "<set name='Quantidade Positivo' value='" & rs_midia("qtd") & "' />"
  135.           strXML = strXML & "<set name='Quantidade Negativo' value='" & rs_midia("qtd_negativa") & "' />"
  136.           strXML = strXML & "<set name='Quantidade Neutro' value='" & rs_midia("qtd_neutra") & "' />"
  137.  
  138.       Else
  139.           'strXML = strXML & "<set name='Tempo' value='" & rs_midia("tempo_negativo") & "' />"
  140.           strXML = strXML & "<set name='Tempo Positivo' value='" & rs_midia("tempo") & "' />"
  141.           strXML = strXML & "<set name='Tempo Negativo' value='" & rs_midia("tempo_negativo") & "' />"
  142.           strXML = strXML & "<set name='Tempo Neutro' value='" & rs_midia("tempo_neutra") & "' />"
  143.          
  144.       End if   
  145.       'Close recordset
  146. '      Set oRs2 = Nothing
  147. '      oRs.MoveNext
  148.     rs_midia.movenext    
  149.    Wend
  150.  End if
  151.    'Finally, close <chart> element
  152.    strXML = strXML & "</graph>"
  153.    'Set oRs = nothing
  154.    Set rs_midia = nothing
  155.  
  156.    'Criar o gráfico - Pie 3D Chart with data from strXML
  157.    Call renderChart("includes/Charts/Pie3D.swf", "", strXML, "FactorySum", 700, 350)
  158.    'Call renderChart("includes/Charts/Column3D.swf", "", strXML, "FactorySum", 700, 350)
  159.    
  160.    Response.Write("<p align='center'><input type='button' class='button' onclick='exportHandler();' value='Export Chart' /></p><div id='fcExportDiv' align='center'>&nbsp;</div>")
  161.    
  162.  
  163.     '#################################   SEGUNDO GRÁFICO   #################################
  164.     strQueryVeiculo = "SELECT nomecliente, midia, veiculo, tipo_medida, sum(qtd) as qtd, sum(qtd_negativa) as qtd_negativa, sum(qtd_neutra) as qtd_neutra, sum(tempo) as tempo, sum(tempo_negativo) as tempo_negativo, sum(tempo_neutra) as tempo_neutra FROM "& vtQuery(1) & " group by veiculo, midia, nomecliente, tipo_medida"
  165.  
  166.     Set rs_veiculo = gpExecuteSQL(strQueryVeiculo)
  167.  
  168.    strXML = "<?xml version='1.0' encoding='UTF-8'?><graph baseFontSize='12' caption='"& rs_veiculo("nomecliente") &"' subCaption='"& rs_veiculo("midia") &"' bgColor='FFFFFF' decimalPrecision='0' showPercentageValues='1' showNames='1' numberPrefix='' showValues='1' showPercentageInLabel='1' pieYScale='60' pieBorderAlpha='50' pieFillAlpha='70' pieSliceDepth='40' pieRadius='150' exportEnabled='1' exportAtClient='1' exportHandler='fcExporter1'>"
  169.  
  170. strXML = strXML & "<categories font='Arial' fontSize='11' fontColor='000000'>"
  171. While Not rs_veiculo.Eof
  172.     strXML = strXML & "<category name='" & rs_veiculo("veiculo") & "' />"
  173.     rs_veiculo.movenext    
  174. Wend
  175. strXML = strXML & "</categories>"
  176.  
  177.  
  178. strXML = strXML & "<dataset seriesname='Positivo' color='FDC12E'>"
  179. rs_veiculo.movefirst   
  180. While Not rs_veiculo.Eof
  181.      If rs_veiculo.fields("tipo_medida") <> "TEMPO" then
  182.       '<set value='30' />
  183.         strXML = strXML & "<set value='" & rs_veiculo("qtd") & "' />"
  184.      Else
  185.         strXML = strXML & "<set value='" & rs_veiculo("tempo") & "' />"
  186.      End if
  187.     rs_veiculo.movenext    
  188. Wend
  189. strXML = strXML & "</dataset>"
  190.  
  191.  
  192. strXML = strXML & "<dataset seriesname='Negativo' color='56B9F9'>"
  193. rs_veiculo.movefirst   
  194. While Not rs_veiculo.Eof
  195.      If rs_veiculo.fields("tipo_medida") <> "TEMPO" then
  196.         strXML = strXML & "<set value='" & rs_veiculo("qtd_negativa") & "' />"
  197.      Else
  198.         strXML = strXML & "<set value='" & rs_veiculo("tempo_negativo") & "' />"
  199.      End if
  200.     rs_veiculo.movenext    
  201. Wend
  202. strXML = strXML & "</dataset>"
  203.  
  204.  
  205. strXML = strXML & "<dataset seriesname='Neutro' color='C9198D' >"
  206. rs_veiculo.movefirst   
  207. While Not rs_veiculo.Eof
  208.      If rs_veiculo.fields("tipo_medida") <> "TEMPO" then
  209.         strXML = strXML & "<set value='" & rs_veiculo("qtd_neutra") & "' />"
  210.      Else
  211.         strXML = strXML & "<set value='" & rs_veiculo("tempo_neutra") & "' />"
  212.      End if
  213.     rs_veiculo.movenext    
  214. Wend
  215. strXML = strXML & "</dataset>"
  216.  
  217. strXML = strXML & "</graph>"
  218.  
  219.  
  220.    strXML2 = strXML2 & "</graph>"
  221.    Set rs_veiculo = nothing
  222.  
  223.    Call renderChart("includes/Charts/FCF_MSColumn3D.swf", "", strXML, "FactorySum2", 700, 350)
  224.    
  225.    Response.Write("<p align='center'><input type='button' class='button' onclick='exportHandler();' value='Export Chart' /></p><div id='fcExportDiv2' align='center'>&nbsp;</div>")
  226.    
  227. %>
  228. </body>
  229. </html>
Advertisement
Add Comment
Please, Sign In to add comment