Javascript 如何在Google图表中添加动态值

Javascript 如何在Google图表中添加动态值,javascript,html,css,graph,Javascript,Html,Css,Graph,当我在GoogleGraph中添加动态值时,它不会显示图形。值已在控制台中成功添加到表中,但未显示图形。为什么?我在这里犯了什么错误 请阅读我的代码,并给我一些解决方案 在此处输入信息。。 位置 成员1 成员2 成员3 成员4 名称 机会成本/工资 工作时间 投资现金 捐款现金 加入该项目的日期 你的那份$ 你的份额% 计算 var share1; var share2、share3、share4; 函数getPrice(){ /*领工资*/ var salary1=parseFloat

当我在GoogleGraph中添加动态值时,它不会显示图形。值已在控制台中成功添加到表中,但未显示图形。为什么?我在这里犯了什么错误

请阅读我的代码,并给我一些解决方案



在此处输入信息。。 位置 成员1 成员2 成员3 成员4 名称 机会成本/工资 工作时间 投资现金 捐款现金 加入该项目的日期 你的那份$ 你的份额%
计算 var share1; var share2、share3、share4; 函数getPrice(){ /*领工资*/ var salary1=parseFloat(document.getElementById(“salary1”).value); var salary2=parseFloat(document.getElementById(“salary2”).value); var salary3=parseFloat(document.getElementById(“salary3”).value); var salary4=parseFloat(document.getElementById(“salary4”).value); /*获取小时数*/ var hours1=parseFloat(document.getElementById(“hours1”).value); var hours2=parseFloat(document.getElementById(“hours2”).value); var hours3=parseFloat(document.getElementById(“hours3”).value); var hours4=parseFloat(document.getElementById(“hours4”).value); /*获得投资现金*/ var invested_cash1=parseFloat(document.getElementById(“invested_cash1”).value); var invested_cash2=parseFloat(document.getElementById(“invested_cash2”).value); var invested_cash3=parseFloat(document.getElementById(“invested_cash3”).value); var invested_cash4=parseFloat(document.getElementById(“invested_cash4”).value); /*获得捐赠现金*/ var contributed_cash1=parseFloat(document.getElementById(“contributed_cash1”).value); var contributed_cash2=parseFloat(document.getElementById(“contributed_cash2”).value); var contributed_cash3=parseFloat(document.getElementById(“contributed_cash3”).value); var contributed_cash4=parseFloat(document.getElementById(“contributed_cash4”).value); var投资=现金1=小时1; var缴款现金1=缴款现金1; var非现金1=投资现金1*51.14; var供款\现金1=供款\现金1*4 var your_share1=非现金1+供款现金1; var投资=现金2=小时2; var缴款现金2=缴款现金2; var非现金2=投资现金2*51.14; var供款\现金2=供款\现金2*4 var your_share2=非现金2+供款现金2; var投资=现金3=小时3; var缴款现金3=缴款现金3; var非现金3=投资现金3*51.14; var供款\现金3=供款\现金3*4 var your_share3=非现金3+供款现金3; var投资=现金4=小时4; var缴款现金4=缴款现金4; var非现金4=投资现金4*51.14; var供款\现金4=供款\现金4*4 var your_share4=非现金4+供款现金4; 投资的风险值=小时1+小时2+小时3+小时4; var缴款现金=缴款现金1+缴款现金2+缴款现金3+缴款现金4; var非现金=投资现金*51.14; var供款现金=供款现金*4 var你的股份=非现金+供款现金; document.getElementById(“share$\u 1”).value=“$”+您的\u share1.toFixed(2); document.getElementById(“share$\u 2”).value=“$”+您的\u share2.toFixed(2); document.getElementById(“share$\u 3”).value=“$”+您的\u share3.toFixed(2); document.getElementById(“share$\u 4”).value=“$”+您的\u share4.toFixed(2); var total=您的共享1+您的共享2+您的共享3+您的共享4; document.getElementById(“share$\ total”).value=total.toFixed(2); share1=((您的_share1/总数)*100); share2=((你的共享2/总数)*100); share3=((你的共享3/总数)*100); share4=((您的共享4/总数)*100)。toFixed(2); var share_total=parseFloat(share1)+parseFloat(share2)+parseFloat(share3)+parseFloat(share4); document.getElementById(“share_1”)。value=share1+“%”; document.getElementById(“share_2”)。value=share2+“%”; document.getElementById(“share_3”)。value=share3+“%”; document.getElementById(“share_4”)。value=share4+“%”; document.getElementById(“share_total”).value=Math.round(share_total)+“%”; 图纸(); } google.charts.load('current'{ “包”:[“核心图表”] }); google.charts.setOnLoadCallback(drawChart); 函数绘图图(){ var值1=股份1; var value2=share2; var值3=股份3; var value4=股份4; var data=google.visualization.arrayToDataTable([ [“任务”,“每天工作小时数”], [‘工作’,价值1], [Eat',value2], [‘通勤’,值3], [‘看电视’,价值4] ]); 变量选项={ 标题:“我的日常活动” }; var chart=new google.visualization.PieChart(document.getElementById('PieChart'); 图表绘制(数据、选项); }
怎么了! 解决了 你所有的值都是字符串!这些被称为错误 这也叫做像这样的错误

未捕获错误:引导工具提示需要

您必须在bootstrap.min.js之前添加脚本

这一定是这样

<head>
    <title>YourTitle</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" />
    <!-- Custom CSS -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.css" />
    <!-- <link href="css/style.css" rel="stylesheet"> -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js"></script>
    <!-- Bootstrap Core JavaScript -->
    <script src="https://npmcdn.com/tether@1.2.4/dist/js/tether.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/js/bootstrap.js"></script>
</head>

你的头衔

你的头衔

在此处输入信息。。 位置 成员1 成员2 成员3 成员4 名称 机会成本/