<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="ComboGraphDespesaFonteFinanciamento.aspx.vb" Inherits="i9.Dashboard.ComboGraphDespesaFonteFinanciamento" %>

<!DOCTYPE html>


<html>
<head>
    <style>
        #print {
            float: right;
            font-family: Verdana;
            color: #0B62A4;
            font-size: 10px;
            right: 10px;
            bottom: 0;
            position: fixed;
            cursor: pointer;
        }
        
        #chart_div{
            width: 100%;
            height: 100%;
            position: absolute;
            top: 0; 
            bottom: 0;
            left: 0; 
            right: 0;
            margin: auto;
        }
        
    </style>

    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
        //google.load("visualization", "1.1", { packages: ["corechart", "geochart"] });
        google.load("visualization", "1", { packages: ["corechart", "bar"] });
        google.setOnLoadCallback(drawChart);

        function drawChart() {
            var data = google.visualization.arrayToDataTable(<%= TheData%>);
            
            var options = {
                tooltip: { textStyle: {fontSize: 10 } },
                annotations: {
                    textStyle: { color: 'black' }
                },
                backgroundColor: 'transparent',
                'title': '<%= Titutlo%>',
                <%= Cor%>,
                seriesType: 'bars',
                series: {2: {type: 'line'}},
                titleTextStyle: { color: 'black'},
                chartArea: { left: '12%', top: '10%', height: '80%', width: '87%' },
                hAxis: { baselineColor: 'black', minValue: 0, textStyle: { fontSize: 10, color: 'black' } },
                vAxis: { baselineColor: 'black', minValue: 0, textStyle: { fontSize: 10, color: 'black' } },
                legend: {
                    position: 'bottom',
                    textStyle: { color: 'black' }
                }

            };

            var chart = new google.visualization.ComboChart(document.getElementById('chart_div'));
            
            // Wait for the chart to finish drawing before calling the getImageURI() method.
            google.visualization.events.addListener(chart, 'ready', function () {
                var imagem=chart.getImageURI();
                
                var url = new URL(window.location.href);
                var param = url.searchParams.get("ID_Graf");
                                
                var urlref=document.location.href;
                
                var pos = urlref.lastIndexOf("/");
                var s="";
                if(pos >= 0)
                    s = urlref.substring(0, pos);

                pos = s.lastIndexOf("/Route");
				if (pos>0) {
					s = s.substring(0, pos);
				}

                var endereco=s+"/WebComponent/Graph/Imagem/SessionImage.aspx";
                                               
                var xhttp = new XMLHttpRequest();
                xhttp.open("POST", endereco, true);
                xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
                xhttp.send("ids="+param+"&imageurl="+imagem); 
            });

            chart.draw(data, options);
        };
    </script>
</head>

<body style="background-color:transparent; overflow:hidden;">
    <div id="chart_div"></div>
</body>
</html>
