Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <% Response.Buffer = True %>
- <!-----#include file="includes/SmartSourceP.asp"-->
- <!-----#include file="includes/SmartSourceS_v01.asp"---------------->
- <!-----#include file="includes/SmartSourceR_v04.asp"--------------->
- <!-----#INCLUDE FILE="includes/FusionCharts.asp"--------------->
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <title>Gráfico</title>
- <style type="text/css">
- <!--
- .titulo {color: #FFFFFF; font-family:"Trebuchet MS", Tahoma, Verdana; font-size:11px}
- .tituloCampo {color: #000000; font-family:"Trebuchet MS", Tahoma, Verdana; font-size:11px}
- .Valor {color: #000000; font-family:"Trebuchet MS", Tahoma, Verdana; font-size:12px}
- .botao {
- color: #FFFFFF;
- font-family:"Trebuchet MS", Tahoma, Verdana;
- font-size:11px;
- background-color: #333333;
- border-top-width: 1px;
- border-right-width: 1px;
- border-bottom-width: 1px;
- border-left-width: 1px;
- border-top-style: inset;
- border-right-style: inset;
- border-bottom-style: inset;
- border-left-style: inset;
- }
- -->
- </style>
- <script src="includes/FusionCharts.js" type="text/javascript"></script>
- <script src="includes/FusionChartsExportComponent.js" type="text/javascript"></script>
- <script>
- //This event is raised when the chart has finished capture phase and passed the data to
- //Export Component for further processing
- function FC_ExportReady(DOMId)
- {
- var myExportComponent = new FusionChartsExportObject("fcExporter1", "includes/Charts/FCExporter.swf");
- //------ Export Component Attributes ------//
- //Set saving mode as individual. This allows users to download individual charts.
- myExportComponent.componentAttributes.saveMode='individual';
- //Show allowed export format drop-down
- myExportComponent.componentAttributes.showAllowedTypes = '1';
- //Cosmetics
- //Width and height
- myExportComponent.componentAttributes.width = '200';
- myExportComponent.componentAttributes.height = '100';
- //Message - caption of export component
- //Render the exporter SWF in our DIV fcexpDiv
- myExportComponent.Render("fcExportDiv");
- var myExportComponent2 = new FusionChartsExportObject("fcExporter2", "includes/Charts/FCExporter.swf");
- //------ Export Component Attributes ------//
- //Set saving mode as individual. This allows users to download individual charts.
- myExportComponent2.componentAttributes.saveMode='individual';
- //Show allowed export format drop-down
- myExportComponent2.componentAttributes.showAllowedTypes = '1';
- //Cosmetics
- //Width and height
- myExportComponent2.componentAttributes.width = '200';
- myExportComponent2.componentAttributes.height = '100';
- //Message - caption of export component
- //Render the exporter SWF in our DIV fcexpDiv
- myExportComponent2.Render("fcExportDiv2");
- }
- function exportHandler()
- {
- var n = document.getElementById('fcExportDiv');
- n.innerHTML = " ";
- //Get reference to chart.
- var chart = getChartFromId("FactorySum");
- var chart2 = getChartFromId("FactorySum2");
- //Now, we proceed with exporting only if chart has finished rendering.
- //We do not check rendering of export component, as FusionCharts Export Object JS
- //has a built-in queue that stacks up the export request until the component is ready.
- if (chart.hasRendered()==true){
- chart.exportChart();
- //fcExportDiv
- }else{
- //alert("Please wait for the chart to finish rendering before you can invoke exporting");
- alert("Por favor, aguarde o processamento gráfico para terminar antes que você pode chamar exportadores");
- }
- if (chart2.hasRendered()==true){
- chart2.exportChart();
- //fcExportDiv
- }else{
- //alert("Please wait for the chart to finish rendering before you can invoke exporting");
- alert("Por favor, aguarde o processamento gráfico para terminar antes que você pode chamar exportadores");
- }
- }
- </script>
- <script>
- //windowWidth=768;
- windowWidth=800;
- windowHeight=550;
- if (parseInt(navigator.appVersion) >= 4) window.moveTo((screen.width/2)-(windowWidth/2+10),(screen.height/2)-(windowHeight/2+20));
- //if (parseInt(navigator.appVersion) >= 4) window.moveTo(0,0);
- </script>
- </head>
- <body>
- <%
- 'Response.Write(Session("gpSQL1"))
- vtQuery = Split(Session("gpSQL1"),"from")
- ''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"
- '################################# PRIMEIRO GRÁFICO #################################
- 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"
- Set rs_midia = gpExecuteSQL(strQueryMidia)
- 'strXML será usado para armazenar todo o documento XML gerado
- 'Gerando o elemento grafico
- 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'>"
- If Not rs_midia.eof Then
- While Not rs_midia.Eof
- If rs_midia.fields("tipo_medida") <> "TEMPO" then
- 'strXML = strXML & "<set name='" & rs_midia("qtd") & "' value='" & rs_midia("qtd_negativa") & "' />"
- strXML = strXML & "<set name='Quantidade Positivo' value='" & rs_midia("qtd") & "' />"
- strXML = strXML & "<set name='Quantidade Negativo' value='" & rs_midia("qtd_negativa") & "' />"
- strXML = strXML & "<set name='Quantidade Neutro' value='" & rs_midia("qtd_neutra") & "' />"
- Else
- 'strXML = strXML & "<set name='Tempo' value='" & rs_midia("tempo_negativo") & "' />"
- strXML = strXML & "<set name='Tempo Positivo' value='" & rs_midia("tempo") & "' />"
- strXML = strXML & "<set name='Tempo Negativo' value='" & rs_midia("tempo_negativo") & "' />"
- strXML = strXML & "<set name='Tempo Neutro' value='" & rs_midia("tempo_neutra") & "' />"
- End if
- 'Close recordset
- ' Set oRs2 = Nothing
- ' oRs.MoveNext
- rs_midia.movenext
- Wend
- End if
- 'Finally, close <chart> element
- strXML = strXML & "</graph>"
- 'Set oRs = nothing
- Set rs_midia = nothing
- 'Criar o gráfico - Pie 3D Chart with data from strXML
- Call renderChart("includes/Charts/Pie3D.swf", "", strXML, "FactorySum", 700, 350)
- 'Call renderChart("includes/Charts/Column3D.swf", "", strXML, "FactorySum", 700, 350)
- Response.Write("<p align='center'><input type='button' class='button' onclick='exportHandler();' value='Export Chart' /></p><div id='fcExportDiv' align='center'> </div>")
- '################################# SEGUNDO GRÁFICO #################################
- 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"
- Set rs_veiculo = gpExecuteSQL(strQueryVeiculo)
- 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'>"
- strXML = strXML & "<categories font='Arial' fontSize='11' fontColor='000000'>"
- While Not rs_veiculo.Eof
- strXML = strXML & "<category name='" & rs_veiculo("veiculo") & "' />"
- rs_veiculo.movenext
- Wend
- strXML = strXML & "</categories>"
- strXML = strXML & "<dataset seriesname='Positivo' color='FDC12E'>"
- rs_veiculo.movefirst
- While Not rs_veiculo.Eof
- If rs_veiculo.fields("tipo_medida") <> "TEMPO" then
- '<set value='30' />
- strXML = strXML & "<set value='" & rs_veiculo("qtd") & "' />"
- Else
- strXML = strXML & "<set value='" & rs_veiculo("tempo") & "' />"
- End if
- rs_veiculo.movenext
- Wend
- strXML = strXML & "</dataset>"
- strXML = strXML & "<dataset seriesname='Negativo' color='56B9F9'>"
- rs_veiculo.movefirst
- While Not rs_veiculo.Eof
- If rs_veiculo.fields("tipo_medida") <> "TEMPO" then
- strXML = strXML & "<set value='" & rs_veiculo("qtd_negativa") & "' />"
- Else
- strXML = strXML & "<set value='" & rs_veiculo("tempo_negativo") & "' />"
- End if
- rs_veiculo.movenext
- Wend
- strXML = strXML & "</dataset>"
- strXML = strXML & "<dataset seriesname='Neutro' color='C9198D' >"
- rs_veiculo.movefirst
- While Not rs_veiculo.Eof
- If rs_veiculo.fields("tipo_medida") <> "TEMPO" then
- strXML = strXML & "<set value='" & rs_veiculo("qtd_neutra") & "' />"
- Else
- strXML = strXML & "<set value='" & rs_veiculo("tempo_neutra") & "' />"
- End if
- rs_veiculo.movenext
- Wend
- strXML = strXML & "</dataset>"
- strXML = strXML & "</graph>"
- strXML2 = strXML2 & "</graph>"
- Set rs_veiculo = nothing
- Call renderChart("includes/Charts/FCF_MSColumn3D.swf", "", strXML, "FactorySum2", 700, 350)
- Response.Write("<p align='center'><input type='button' class='button' onclick='exportHandler();' value='Export Chart' /></p><div id='fcExportDiv2' align='center'> </div>")
- %>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment