Question User Question User - 4 months ago 18
Javascript Question

fusion charts passing paramaters split with comma creates some error

Here I have function that will call fusion charts that will listed below charts are working fine. Here what was the problem is while I'm passing the parameter the splitting the comma due to this value

Here I'm passing the values from php

$categoryvalue = '{"label":"Q1"},{"label":"Q2"},{"label":"Q3"},{"label":"Q4"},{"label":"Q5"},{"label":"Q6"}';

$setvalue1= `'{"value":"0"},{"value":"244"},{"value":"65"},{"value":"52"},{"value":"169"},{"value":"40"}';

$setvalue2 ='{"value":"0"},{"value":"37"},{"value":"53"},{"value":"5"},{"value":"45"},{"value":"4"}'


Script

<script>
function fusioncharts(type,rendernamew,w,h,xaxisname,yaxisname,labelname1,labelname2,categoryvalue,setvalue1,setvalue2){
// here code starts
}
</script>


Error


fusioncharts('mscolumn2d','chartContainer','900','400','Quarter','Revenues (In USD)','Incidents Submitted','Incidents Resolved',{"label":"Q1",{"label":"Q2",{"label":"Q3");


Now it says some error like this


FusionCharts.js:158 Uncaught TypeError: a.match is not a function

Answer

just you can add the [ this in both string. This will solve you

$categoryvalue = '[{"label":"Q1"},{"label":"Q2"},{"label":"Q3"},{"label":"Q4"},{"label":"Q5"},{"label":"Q6"}]';

$setvalue1=  '[{"value":"0"},{"value":"244"},{"value":"65"},{"value":"52"},{"value":"169"},{"value":"40"}]';

$setvalue2 ='[{"value":"0"},{"value":"37"},{"value":"53"},{"value":"5"},{"value":"45"},{"value":"4"}]'
Comments