very very thanx to you.now i can understand

On Tue, Dec 9, 2014 at 8:19 PM, 'Sergey Grabkovsky' via Google
Visualization API <[email protected]> wrote:

> Hi,
>
> I'm not 100% clear on what you're asking for help with here, but I put
> your code into a jsfiddle and got the error "Type mismatch. Value 2014 does
> not match type date in column index 0", so I will assume that that's what
> you're asking for help with.
>
> Here is the raw jsfiddle: http://jsfiddle.net/z2w97syn/
>
> The issue with that particular error is that you're specifying the type of
> the first column in your DataTable as a "date", but are giving it a number.
> What you should be doing is creating a new Date object with that year. The
> error is on line 60 of the JavaScript.
>
> The next issue is that you're trying to use form inputs as numbers, but
> they are initially strings. So you have to use parseFloat or parseInt to
> convert them to numbers. That error is on line 47 of your JavaScript.
>
> Here is a fixed version of your code: http://jsfiddle.net/6g27juL0/
>
> On Tue Dec 09 2014 at 6:05:26 AM gourav kumar <[email protected]>
> wrote:
>
>> Here is  my code
>> like this http://emicalculator.net/
>> please help me
>> <html>
>> <head><title>Vehicle Loan EMI Calculator Script</title>
>>  <script type="text/javascript" src="https://www.google.com/jsapi
>> "></script>
>>  <script type="text/javascript">
>>      google.load("visualization", "1", {packages:["corechart"]});
>> //google.setOnLoadCallback(drawChart);
>> function drawChart() {
>>
>>   //alert(principal);
>>
>>
>>   var data = new google.visualization.DataTable();
>>   data.addColumn('string', 'year');
>>   data.addColumn('number', 'principal');
>>   data.addColumn('number', 'balance');
>>   data.addColumn('number', 'interest');
>>   var d = new Date();
>>   var n = d.getFullYear();
>>   for(var i = n; i <= n+4; i++){
>>     data.addRows([
>>     ['i',i,i,i]
>>     ]);
>> }
>>   var options = {
>>     title: 'Company Performance',
>>     hAxis: {title: 'Year', titleTextStyle: {color: 'red'}}
>>   };
>>
>>   var chart = new
>> google.visualization.ColumnChart(document.getElementById('chart_div'));
>>
>>   chart.draw(data, options);
>>
>> }
>>     </script>
>> </head>
>> <body>
>> <script type="text/javascript">
>> function checnum(as){
>> var a = as.value;
>> for(var x=0; x<a.length; x++)
>> {
>> var ff = a[x];
>> if(isNaN(a))
>> {
>> a = a.substring(0,(a.length-1));
>> as.value = a;
>> }}
>> }
>> function loanemi_calc()
>> {
>>  var j = document.getElementById("lamt").value;
>>    //alert(principal);
>>
>>
>>   var data = new google.visualization.DataTable();
>>   data.addColumn('date', 'year');
>>   data.addColumn('number', 'principal');
>>   data.addColumn('number', 'balance');
>>   data.addColumn('number', 'interest');
>>   var d = new Date();
>>   var n = d.getFullYear();
>>   for(var i = n; i <= n+4; i++){
>>     data.addRows([
>>     [i,j,i,i]
>>     ]);
>> }
>>   var options = {
>>     title: 'Company Performance',
>>     hAxis: {title: 'Year', titleTextStyle: {color: 'red'}}
>>   };
>>
>>   var chart = new
>> google.visualization.ColumnChart(document.getElementById('chart_div'));
>>
>>   chart.draw(data, options);
>> var sds = document.getElementById("dum");
>> if(sds == null){
>> alert("You are using a free package.\n You are not allowed to remove the
>> copyright.\n");
>> }
>> var sdss = document.getElementById("dumdiv");
>> if(sdss == null){
>> alert("You are using a free package.\n You are not allowed to remove the
>> copyright.\n");
>> }
>> if(sdss != null)
>> {var lamt = document.getElementById("lamt").value;var dpay =
>> document.getElementById("dpay").value;var inte =
>> document.getElementById("inte").value;var term =
>> document.getElementById("term").value;if(lamt==""){alert("Enter Vehicle
>> loan amount");document.getElementById("lamt").focus();}else
>> if(inte==""){alert("Enter interest rate in
>> percentage");document.getElementById("dpay").focus();}else
>> if(term==""){alert("Enter term of loan
>> payment");document.getElementById("inte").focus();}else{if(dpay==""){dpay =
>> 0;document.getElementById("term").value=dpay;$("#dpay").val(dpay);}lamt =
>> parseFloat(lamt);dpay = parseFloat(dpay);inte = parseFloat(inte);term =
>> parseFloat(term);if(dpay<=lamt){var p = lamt - dpay;var r = inte/1200;var
>> part1 = Math.pow((1+r), term);var part2 = p * r * part1;var part3 = part1 -
>> 1;var emi = Math.round(100 * (part2 / part3)) /
>> 100;document.getElementById("emi").value=emi;var tamt = Math.round(100 *
>> emi * term) / 100;document.getElementById("tamt").value=tamt;var tip =
>> Math.round(100 * (tamt - p)) /
>> 100;document.getElementById("tip").value=tip;}else{alert("Enter down
>> payment less than the Auto loan
>> amount");document.getElementById("dpay").value="";document.getElementById("dpay").focus();}}
>> }
>> }
>> function reset()
>> {
>> document.getElementById("lamt").value="";document.getElementById("dpay").value="";document.getElementById("inte").value="";document.getElementById("term").value="";document.getElementById("emi").value="";document.getElementById("tip").value="";document.getElementById("tamt").value=""
>> ;
>> }
>> </script>
>> <div id="calculator">
>> <div align='center'><h3>Vehicle Loan EMI Calculator Script</h3></div>
>> <table width="100%" border="0" cellpadding="0" cellspacing="4" ><tr><td
>> colspan=2><table
>> width=100% height=100%>
>> <tr><td>
>> <form name=first><table align=center border=0 cellpadding=1 cellspacing=1
>> id=emi_calc style='font-size:12px;'>
>> <tr><td>Amount (Vehicle Price)
>> </td> <td> <input type=number id=lamt onkeyup=checnum(this); maxlength=9>
>> </td> </tr>
>> <tr><td>Down Payment
>> </td> <td> <input type=text id=dpay onkeyup=checnum(this); maxlength=9>
>> </td> </tr>
>> <tr><td>Annual Interest Rate
>> </td> <td> <input type=text id=inte onkeyup=checnum(this); maxlength=9> %
>> </td> </tr>
>> <tr><td>Term/Period </td> <td> <input type=text id=term
>> onkeyup=checnum(this); maxlength=9> months </td> </tr>
>> <tr><td colspan=2>
>> </td></tr>
>> <tr><td colspan=2 align=center><input type=button value='Calculate'
>> onclick=loanemi_calc();>
>> <input type=button value='Reset' onclick="reset();"></td></tr>
>> <tr><td colspan=2 style="font-size:11px;" align="center" colspan='2'
>> id='dumdiv'><a href="https://www.hscripts.com"; style="color: #3D366F;
>> font-size:11px; text-decoration:none;" id=dum></a></td></tr>
>> <tr><td>Monthly Payment </td> <td> <input type=text id=emi readonly>
>> </td> </tr>
>> <tr><td>Total Interest Payment
>> </td> <td> <input type=text id=tip readonly> </td> </tr>
>> <tr><td>Total Amount to Pay
>> </td> <td> <input type=text id=tamt readonly> </td> </tr></table>
>> </form></table>
>> </div>
>>  <div id="chart_div" style="width: 900px; height: 500px;"></div>
>> </body>
>> </html>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Visualization API" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to
>> [email protected].
>> Visit this group at
>> http://groups.google.com/group/google-visualization-api.
>> For more options, visit https://groups.google.com/d/optout.
>>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Google Visualization API" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/google-visualization-api/FL3-5oQIJ_4/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to
> [email protected].
> Visit this group at
> http://groups.google.com/group/google-visualization-api.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to