25 Out 2020 18:56
#xcommand TEXT TO VAR <var> => #pragma __stream|<var>:=%s
#xcommand ENDTEXT => #pragma __endtext
FUNCTION Pie_Chart(cPedacos, cTitulo, cLegenda, cArq)
LOCAL cHtml, nHan
Text TO VAR cHTML
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load("current", {packages:["corechart"]});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
xPedacos
]);
var options = {
title: xTitulo,
is3D: true,
};
var chart = new google.visualization.PieChart(document.getElementById('piechart_3d'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="piechart_3d" style="width: 900px; height: 500px;"></div>
</body>
</html>
ENDTEXT
cHTML := StrTran(cHtml,'xPedacos',cPedacos)
cHTML := StrTran(cHtml,'xTitulo',cTitulo)
cHtml += '</html>'
nHan := FCREATE( cARQ )
FWRITE ( nHan , cHTML , LEN( cHTML ) )
FCLOSE( nHan )
__RUN( "START EXPLORER " + cArq )
25 Out 2020 19:07
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load("current", {packages:["corechart"]});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Grupos','Vendas Por Grupo'],
['BANHEIRO', 842.51],
['COZINHA', 596.87],
['MATERIAIS ELETRICOS', 45769.50],
['ESQUADRIAS MADEIRA', 15682.21],
['FERRAGENS', 126757.48],
['HIDRAULIC0 AGUA', 21202.68],
['HIDRAULICO ESGOTO', 20358.40],
['TUBOS', 33724.37],
['JARDINAGEM', 520.08],
['MADEIRA', 2329.80],
['MATERIAL BRUTO', 287457.03],
['METAIS SANITARIOS', 59051.48],
['PISOS', 126840.66],
['TINTAS', 113703.60],
['VEDACIT', 5380.93]
]);
var options = {
title: 'Vendas Por Grupos, Início: 01/10/20 Fim: 31/10/20 - Total: 860.279,60',
is3D: true,
};
var chart = new google.visualization.PieChart(document.getElementById('piechart_3d'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="piechart_3d" style="width: 900px; height: 500px;"></div>
</body>
</html>
</html>
cGrupos := "['Grupos','Vendas Por Grupo']," + hb_eol()
Do while
do while SeuCodGrupo == cCodGrupo
nTotalGrupo += ...
skip
enddo
cGrupos += "['" + AllTrim(gr->grupo) + "'," + Transform(nTotalGrupo,"9999999999.99") + "]"
IF hm->(!Eof())
cGrupos += ',' + hb_eol()
ENDIF
nTotal += nTotalGrupo
ENDDO
cTitulo := 'Vendas Por Grupos, Início: ' + dtoc(dIni) + ' Fim: ' + dtoc(dFim) + ' - Total: ' + Transform(nTotal,"@e 99999,999,999.99")
Pie_Chart(cGrupos, cTitulo, cLegenda, "pie_chart_grupos.html")
26 Out 2020 15:10
26 Out 2020 15:55
rochinha escreveu:você chegou a testar o mesmo código usando o httpd do Harbour?
26 Out 2020 17:16
Itamar você chegou a testar o mesmo código usando o httpd do Harbour?
26 Out 2020 17:24
27 Out 2020 16:03
27 Out 2020 16:11
Itamar M. Lins Jr. escreveu:O windows 10 tem 3 versões de navegadores.
27 Out 2020 17:16
27 Out 2020 17:19
Itamar M. Lins Jr. escreveu:Não funcionou no navegador da M$. Alias o que está funcionando nos navegadores da M$ ? O windows 10 tem 3 versões de navegadores.
27 Out 2020 17:23
27 Out 2020 19:32
<body>
<div id="piechart_3d" style="width: 900px; height: 500px;"></div>
</body>
var chart = new google.visualization.PieChart(document.getElementById('piechart_3d'));
chart.draw(data, options);
27 Out 2020 20:12
que não funcionou no W10 dele,
Can I use charts offline?
Your users' computers must have access to https://www.gstatic.com/charts/loader.js in order to use the interactive features of Google Charts. This is because the visualization libraries that your page requires are loaded dynamically before you use them. The code for loading the appropriate library is part of the included script, and is called when you invoke the google.charts.load() method. Our terms of service do not allow you to download the google.charts.load or google.visualization code to use offline.
Can I download and host the chart code locally, or on an intranet?
Sorry; our terms of service do not allow you to download and save or host the google.charts.load or google.visualization code. However, if you don't need the interactivity of Google Charts, you can screenshot the charts and use them as you wish.