webview google graph subtitle

Post Reply
MGA
Posts: 1269
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá
Contact:

webview google graph subtitle

Post by MGA »

How can I control the title and subtitle of a chart?
When I set title: 'test', the subtitle will have the same value. I would like to be able to configure both.

Image

//part of a function taken from the forum:
cFuncion := cFuncion + " ]);"+;
"var options = { "+;
" title: '"+cTitulo+"',"+;
" hAxis: {title: '" + Alltrim(cHorTitle) + "'},"+;
" vAxis: {prefix:'R$', format: 'R$ #,##0.00', title: '" + Alltrim(cVerTitle) + "'},"+;
" widht: '100%',"+;
" height: 300, "+;
" isStacked: true, "+;
" is3D: " + IIf(lIs3D,"true ","false ")+;
"};"+;
"var chart = new google.visualization."+cTipo+"(document.getElementById('"+cNombre+"'));"+;
"chart.draw(data, options);"+;
"var formatter = new google.visualization.NumberFormat({ prefix: 'R$ ', decimalSymbol: ',', groupingSymbol: '.' }); formatter.format(data, 0); formatter.format(data, 1);"+;
"}"+;
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
User avatar
Antonio Linares
Site Admin
Posts: 42716
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 93 times
Been thanked: 103 times
Contact:

Re: webview google graph subtitle

Post by Antonio Linares »

Please post your complete HTML code here
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
cmsoft
Posts: 1308
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina
Has thanked: 2 times
Been thanked: 4 times

Re: webview google graph subtitle

Post by cmsoft »

Por si te sirve, aca tienes un ejemplo de dashboar
https://www.fivetechsupport.com/forums/ ... 75#p273775
MGA
Posts: 1269
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá
Contact:

Re: webview google graph subtitle

Post by MGA »

Cesar,

I am basing myself on your code, it is being very useful. Thank you very much.
Cesar, the title provided below is the same as the subtitle, I would like to have a new parameter: cSubTitle

METHOD AddGraph (cNombre, cTitulo, cTipo, aColumnsData, aData, cColor )


METHOD AddGraph (cNombre, cTitulo, cTipo, aColumnsData, aData, cColor )
Local cGraph, cFuncion, cId, i
cGraph := cNombre+'();//AgregarChar'
::cHtml := strtran(::cHtml,"//AgregarChar",cGraph)
cFuncion := "function "+cNombre+"() { "+;
"var data = google.visualization.arrayToDataTable(["+;
" ['"+aColumnsData[1]+"', '"+aColumnsData[2]+"'], "
for i := 1 to len(aData)
cFuncion := cFuncion + "['"+aData[i,1]+"', "+STR(aData[i,2])+"],"
next i
cFuncion := cFuncion + " ]);"+;
"var options = { "+;
" title: '"+cTitulo+"',"+;
" widht: '100%',"+;
" height: 300, "+;
" is3D: true "+;
"};"+;
"var chart = new google.visualization."+cTipo+"(document.getElementById('"+cNombre+"'));"+;
"chart.draw(data, options);"+;
"}"+;
"//FuncionGrafico"
::cHtml := strtran(::cHtml,"//FuncionGrafico",cFuncion)
cId := '<div class="bg-white shadow-md p-6 rounded-lg">'+;
'<h2 class="text-xl font-bold mb-4 text-'+cColor+'-500">'+cTitulo+'</h2>'+;
'<div id="'+cNombre+'"></div>'+;
'</div>'+;
'<!-- idgrafico -->'
::cHtml := strtran(::cHtml,"<!-- idgrafico -->",cId)
return Self
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
User avatar
cmsoft
Posts: 1308
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina
Has thanked: 2 times
Been thanked: 4 times

Re: webview google graph subtitle

Post by cmsoft »

Creo que seria algo asi

Code: Select all | Expand

METHOD AddGraph (cNombre, cTitulo, cTipo, aColumnsData, aData, cColor)


METHOD AddGraph (cNombre, cTitulo, cTipo, aColumnsData, aData, cColor,cSubTitulo) // Cambiar aca
Local cGraph, cFuncion, cId, i
cGraph := cNombre+'();//AgregarChar'
::cHtml := strtran(::cHtml,"//AgregarChar",cGraph)
cFuncion := "function "+cNombre+"() { "+;
"var data = google.visualization.arrayToDataTable(["+;
" ['"+aColumnsData[1]+"', '"+aColumnsData[2]+"'], "
for i := 1 to len(aData)
cFuncion := cFuncion + "['"+aData[i,1]+"', "+STR(aData[i,2])+"],"
next i
cFuncion := cFuncion + " ]);"+;
"var options = { "+;
" title: '"+cSubTitulo+"',"+; //Cambiar Aca
" widht: '100%',"+;
" height: 300, "+;
" is3D: true "+;
"};"+;
"var chart = new google.visualization."+cTipo+"(document.getElementById('"+cNombre+"'));"+;
"chart.draw(datos, opciones);"+;
"}"+;
"//FuncionGrafico"
::cHtml := strtran(::cHtml,"//FuncionGrafico",cFuncion)
cId := '<div class="bg-white shadow-md p-6 rounded-lg">'+;
'<h2 class="text-xl font-bold mb-4 text-'+cColor+'-500">'+cTitulo+'</h2>'+;
'<div id="'+cNombre+'"></div>'+;
'</div>'+;
'<!-- idgrafico -->'
::cHtml := strtran(::cHtml,"<!-- idgrafico -->",cId)
return Self
MGA
Posts: 1269
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá
Contact:

Re: webview google graph subtitle

Post by MGA »

Cesar, thank you very much, your example is being very useful. :D
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
Post Reply