生成示例圖

div#viewcharts {
display: none;
width: 100px;
clear: both;
margin: 0 auto;
color: #fff;
background: #4512a7;
padding: 5px 10px;
cursor: pointer;
}

jQuery(document).ready(function($){

$(“#viewcharts”).click(function(){
google.charts.load(“current”, {packages:[“corechart”]});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var sq = $(“div#ipt_fsqm_form_7_freetype_4 span.ipt_uif_mathematical_span”).text();
sq = sq.replace(/\,/g, “”);
sq = Number(sq);
/**/
var sq2 = $(“div#ipt_fsqm_form_7_freetype_10 span.ipt_uif_mathematical_span”).text();
sq2 = sq2.replace(/\,/g, “”);
sq2 = Number(sq2);
/**/
var sq3 = $(“div#ipt_fsqm_form_7_freetype_8 span.ipt_uif_mathematical_span”).text();
sq3 = sq3.replace(/\,/g, “”);
sq3 = Number(sq3);
/**/
var sq4 = $(“div#ipt_fsqm_form_7_freetype_12 span.ipt_uif_mathematical_span”).text();
sq4 = sq4.replace(/\,/g, “”);
sq4 = Number(sq4);
/**/
var sq4ins = $(“div#ipt_fsqm_form_7_freetype_154 span.ipt_uif_mathematical_span”).text();
sq4ins = sq4ins.replace(/\,/g, “”);
sq4ins = Number(sq4ins);
var data = google.visualization.arrayToDataTable([

[‘貸款示例’, ‘實時計算’],
[‘首期’, sq],
[‘貸款總額’, sq2],
[‘全期利息’, sq3],
[‘印花稅’, sq4],
[‘保險費’, sq4ins]
]);

var options = {
legend: { position: ‘none’ },
chartArea:{left:10,top:20,width:”90%”,height:”90%”},
legend: ‘none’,
pieHole: 0.6,
backgroundColor:’#f7f3ff’
};

var chart = new google.visualization.PieChart(document.getElementById(‘donutchart’));
chart.draw(data, options);
}
});

});
jQuery(document).ready(function($){
$(“div#ipt_fsqm_form_wrap_7”).click(function(){
setTimeout(function(){ $( “#viewcharts” ).trigger( “click” ); }, 500);
});

});

jQuery(document).ready(function($){
//获取dom
let domContent = document.querySelector(‘#ipt_fsqm_form_7_mcq_5’);

//定义各类事件,为了可以解除事件绑定,事件回调不使用匿名函数
function handleClick() {
$( “#viewcharts” ).trigger( “click” );
}
function handleLeft() {
$( “#viewcharts” ).trigger( “click” );
}
function handleRight() {
$( “#viewcharts” ).trigger( “click” );
}
function handleUp() {
$( “#viewcharts” ).trigger( “click” );
}
function handleDown() {
$( “#viewcharts” ).trigger( “click” );
}
function handleLong() {
$( “#viewcharts” ).trigger( “click” );
}
//绑定点击事件
EventUtil.bindEvent(domContent, ‘click’, handleClick);
//绑定两次左滑事件
EventUtil.bindEvent(domContent, ‘swipeleft’, handleLeft);
//绑定右滑事件
EventUtil.bindEvent(domContent, ‘swiperight’, handleRight);
//上滑事件
EventUtil.bindEvent(domContent, ‘slideup’, handleUp);
//下滑事件
EventUtil.bindEvent(domContent, ‘slidedown’, handleDown);
//长按点击事件
EventUtil.bindEvent(domContent, ‘longpress’, handleLong);
});