No 'exthend' method in pie chart

Hi!

My pie chart was working perfectly and suddenly, without warning, it doesnt work anymore. The script looks fine and the code of the web is ok too…

The error that Firefox Firebug and Chrome describe is “Uncaught TypeError: Object function (a){for(var b in a)dhtmlx[b]=a[b];return dhtmlx} has no method ‘extend’”…

What does it mean?

Thanks for all your help!

Hi,

we need some sample or direct link that allows to reproduce the problem locally.

This is my code… the web works in plsql webtoolkit…

htp.print(’’ );

htp.print(’’ );

htp.print(’’ );
htp.print(’ var data1 = [’ );
htp.print(’{ value:“2.9”, label:“2000” },
{ value:“3.5”, label:“2001” },
{ value:“3.1”, label:“2002” },
{ value:“4.2”, label:“2003” },
{ value:“4.5”, label:“2004” },
{ value:“9.6”, label:“2005” },
{ value:“7.4”, label:“2006” },
{ value:“9.0”, label:“2007” },
{ value:“7.3”, label:“2008” },
{ value:“2.8”, label:“2009” }’);
htp.print(’ ];’);

htp.print(’ var barChart1; ‘);
htp.print(’ barChart1 = new dhtmlXChart({ ‘);
htp.print(’ view:“pie3D”, ‘);
htp.print(’ container:“chart1”, ‘);
htp.print(’ value: “#numSolicitudes#”, ‘);
htp.print(’ gradient: true, ');
htp.print('radius: 100, ');
htp.print('x: 130, ');
htp.print('y: 150, ‘);
htp.print(’ tooltip: { ‘);
htp.print(’ template: “#codDescri#” + " - Nº Titulares: " + “#formato#” ‘);
htp.print(’ }, ');
htp.print('legend:{ ‘);
htp.print(’ width: 290, ‘);
htp.print(’ align: “right”, ‘);
htp.print(’ valign: “middle”, ‘);
htp.print(’ marker:{ ‘);
htp.print(’ type: “round”, ‘);
htp.print(’ width: 10, ‘);
htp.print(’ height: 10 ‘);
htp.print(’ }, ‘);
htp.print(’ template: “#codDescri#” + " ( “+”#porcentaje#" + " %)" ‘);
htp.print(’ } ‘);
htp.print(’ }) ‘);
htp.print(’ barChart1.parse(data1,“json”); ');

htp.tableRowOpen;
htp.tableData( htf.div( ‘center’, ‘id=“chart1” style="width:560px; height:350px;
border:1px solid #A4BED4; float:left; font-size:10; font-family:Arial; text-align:left; "’ ) || ’ ‘’, ccolspan=>3 );
htp.tableRowClose;

This code snippet is not enough. Could you send a complete demo ir direct link to the problematic page.

Make sure that chart init is called after its container is created (you may use window.onload handler).

This is all the code of my package, avoiding non important parts for the chart like the initial declaration of parameters, etc… This is all that is involved in the DHTMLX chart generation…

– Web page
htp.htmlOpen;
htp.headOpen;

– Style sheet
htp.print(BDA_UTILIDADES_WEB.PARAM_Hoja_Estilos);

 htp.print('<script type="text/javascript" src="'||bda_utilidades_web.param_ruta_dhtmlx||'/dhtmlx/dhtmlxChart/codebase/dhtmlxchart.js"></script>' );
 htp.print('<link rel="stylesheet" type="text/css" href="'||bda_utilidades_web.param_ruta_dhtmlx||'/dhtmlx/dhtmlxChart/codebase/dhtmlxchart.css">' );
 
 htp.print('<SCRIPT language="JavaScript">' );

-- Pie chart
			
htp.print(' var data1 = ['								);
htp.print('{ numSolicitudes:"100", codCcaa:"01", porcentaje:"10", formato:"10", codDescri:"CCAA" },');
htp.print('{ numSolicitudes:"100", codCcaa:"02", porcentaje:"10", formato:"10", codDescri:"CCAA" },');
htp.print('{ numSolicitudes:"100", codCcaa:"03", porcentaje:"10", formato:"10", codDescri:"CCAA" },');
htp.print('{ numSolicitudes:"100", codCcaa:"04", porcentaje:"10", formato:"10", codDescri:"CCAA" },');
htp.print('{ numSolicitudes:"100", codCcaa:"05", porcentaje:"10", formato:"10", codDescri:"CCAA" },');
htp.print('{ numSolicitudes:"100", codCcaa:"06", porcentaje:"10", formato:"10", codDescri:"CCAA" }');
htp.print('    ];'); 
  
	htp.print('	var barChart1;									');
	htp.print('	window.onload = function() {					');
	htp.print('	barChart1 =  new dhtmlXChart({					');        
	htp.print('	view:"pie3D", 									');
	htp.print('	container:"chart1", 							');
	htp.print('	value: "#numSolicitudes#", 						');
	htp.print(' gradient: true,									');
	htp.print('radius: 100,										');
	htp.print('x: 130,											');
	htp.print('y: 150,											');
	htp.print('	tooltip: { 										');
	htp.print(' 	    template: "#codDescri#" + " - Nº Titulares: " + "#formato#" ');
	htp.print('   		 }, 									');
	htp.print('legend:{											');
	htp.print('	             width: 290,						');
	htp.print('	             align: "right",					');
	htp.print('	             valign: "middle",					');
	htp.print('	             marker:{							');
	htp.print('      	                 type: "round",			');
	htp.print('	                 width: 10,						');
	htp.print('	                 height: 10						');
	htp.print('                     },							');
	htp.print('              template: "#codDescri#" + " ( "+"#porcentaje#" + " %)" ');
	htp.print('                }					 			');
	htp.print('	}) 												');

	-- Tite
	htp.print('document.getElementById("chart1").innerHTML += ''<DIV ALIGN=center; solid #A4BED4; style="position:absolute;top:5px;left:245px;z-index:1;"><DIV STYLE="font-size:12; font-family:Arial; font-weight: bold;">Nº de Titulares</DIV>'';');
	htp.print('document.getElementById("chart1").innerHTML += ''<DIV ALIGN=center; solid #A4BED4; style="position:absolute;top:25px;left:218px;z-index:1"><DIV STYLE="font-size:10; font-family:Arial">Pulsar el gráfico para detalle</DIV>'';	');

    htp.print('	barChart1.parse(data1,"json"); 				'); 
	htp.print('	} 											');
	
htp.print('</SCRIPT> 									');

htp.headClose;

– Body
htp.bodyOpen;

– Form
htp.FormOpen(‘bda_graficos_abandono_vinedo.pant_graficos_ccaa’, cmethod => ‘POST’, cattributes => ‘name=“formulario”’);

– Table
htp.tableOpen(cattributes => ‘class =“to_100c_ce” align=“center”’);
htp.tableRowOpen;
htp.tableData( htf.div( ‘center’, ‘id=“chart1” style="width:560px; height:350px;
border:1px solid #A4BED4; float:left; font-size:10; font-family:Arial; text-align:left; "’ ) || ‘’, ccolspan=>3 );
htp.tableRowClose;
htp.tableClose;

–Close

htp.formClose;
htp.bodyClose;
htp.htmlClose;

The code snippets that you sent are not a complete demo. Here is what I meant:

docs.dhtmlx.com/doku.php?id=othe … leted_demo

Ok, this zip contains a brief example that does not work in my PC… i am using IE8…

Thanks for your help…
DEMO.7z (13 KB)

You did not incliude the “thirdparty” folder from the dhtmlxChart/codebase folder. It must be included. Also you are not using the latest Chart version. I recommend to update chart libs.

Hi…

I included the “thirdparty” and i have actualized the “chart” version to 3.5, and it doesnt work yet…

Hi,

I’ve attached your demo with thirdparty folder and new chart libs - I works in IE8. Please check.
DEMO.ZIP (38.8 KB)

you´re right, it works… the matter is that when i put this javascript code into SQL Web Toolkit it doesn’t work…

The IE8´s warning is “The object does not accept this property or method; dhtmlxchart.js” and in Google Chrome the alert says “TypeError: Object function (obj){for (var a in obj)dhtmlx[a]=obj[a];return dhtmlx;} has no method ‘extend’”.

Could you provide a link to the problematic page (you may post private message) ?

Unfortunately i work for the government on a internal application and i cannot provide a link to share the problematic web…

It’s very frustrating…

Anyway, thanks a lot for your help!