Example of how to use the jQuery highhighhighcharts to draw a 2D bar chart, line chart, and pie chart combination graph [demo source code download], jqueryhighcharts
This article describes how the jQuery highins HighCharts can draw 2D bar charts, line charts, and pie charts. We will share this with you for your reference. The details are as follows:
1. instance code:
// generate random names
function getName () {
var familyNames = new Array (
"Zhao", "Money", "Sun", "Li", "Zhou", "Wu", "Zheng", "Wang", "Feng", "Chen",
"Chu", "wei", "jiang", "shen", "han", "yang", "zhu", "qin", "you", "xu",
"He", "Lu", "Shi", "Zhang", "Kong", "Cao", "Yan", "Hua", "Gold", "Wei",
"Tao", "Ginger", "Qi", "Xie", "Zou", "Yu", "Bai", "Water", "Sinus", "Chapter",
"Yun", "su", "pan", "ge", "ge", "fan", "peng", "lang", "lu", "wei",
"Chang", "Horse", "Miao", "Feng", "Flower", "Fang", "Yu", "Ren", "Yuan", "Liu",
"酆", "Bao", "History", "Tang", "Fei", "Lian", "Cen", "Xue", "Ray", "He",
"Ni", "Tang", "Teng", "Yin", "Luo", "Bi", "Hao", "邬", "安", "常",
"乐", "于", "时", "FU", "皮", "卞", "齐", "康", "武", "余",
"Yuan", "Bu", "Gu", "Meng", "Ping", "Huang", "He", "Mu", "Xiao", "Yin"
);
var givenNames = new Array (
"Zixuan", "Miao", "Guodong", "Master", "Suitang", "Sweet", "Min", "Shang", "Guoxian", "He Xiang", "Chen Tao",
"Hao Xuan", "Yixuan", "Yi Chen", "Yi Fan", "Yi Ran", "Jin Chun", "Jin Kun", "Chun Qi", "Yang", "Wen Hao",
"Dongdong", "Xionglin", "Hao Chen", "Xi Han", "Rong Rong", "Bing Feng", "Xin Xin", "Yi Hao", "Xin Hui", "Jian Zheng",
"Meixin", "Shuhui", "Wenxuan", "Wenjie", "Xinyuan", "Zhonglin", "Rongrun", "Xinru", "Huijia", "New",
"Jian Lin", "Yi Fei", "Lin", "Bing Jie", "Jia Xin", "Han Han", "Yu Chen", "Chun Mei", "Ze Hui", "Wei Yang",
"Han Yue", "Run Li", "Xiang", "Shu Hua", "Jing Ying", "Ling Jing", "Ling Xi", "Yu Han", "Jia Yi", "Jia Yi",
"Zichen", "Jiaqi", "Zixuan", "Ruichen", "Xin Rui", "Meng", "Ming Yuan", "Xin Yi", "Ze Yuan", "Xin Yi",
"Jia Yi", "Jia Hui", "Chen Qian", "Chen Lu", "Yun Hao", "Ru Xin", "Ru Jun", "Jing Ye", "Run Sha", "Rong Shan",
"Jia Yu", "Jia Yu", "Xiao Qing", "Yi Ming", "Yu Chen", "Tian Chi", "Tian Hao", "Yuze", "Ya Ying", "Ya Han",
"Qing Yan", "Shi Yue", "Jia Le", "Chen Han", "Tian He", "Pride", "Jia Hao", "Tian Hao", "Meng Meng", "Ruo Meng"
);
var i = parseInt (10 * Math.random ()) * 10 + parseInt (10 * Math.random ());
var familyName = familyNames [i];
var j = parseInt (10 * Math.random ()) * 10 + parseInt (10 * Math.random ());
var givenName = givenNames [i];
var name = familyName + givenName;
var x = document.getElementsByName ("client_name");
for (var i = 0; i <x.length; i ++) {
var o = x [i];
o.value = name;
}
}
// Generate a random mobile phone number
function getMoble () {
var prefixArray = new Array ("130", "131", "132", "133", "135", "137", "138", "170", "187", "189");
var i = parseInt (10 * Math.random ());
var prefix = prefixArray [i];
for (var j = 0; j <8; j ++) {
prefix = prefix + Math.floor (Math.random () * 10);
}
var x = document.getElementsByName ("mobile_tel");
for (var i = 0; i <x.length; i ++) {
var o = x [i];
o.value = prefix;
}
}
// Generate random ID number
function getId_no () {
var coefficientArray = ["7", "9", "10", "5", "8", "4", "2", "1", "6", "3", "7", "9 "," 10 "," 5 "," 8 "," 4 "," 2 "]; // weighting factor
var lastNumberArray = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"]; / / Check code
var address = "420101"; // address
var birthday = "19810101"; // birthday
var s = Math.floor (Math.random () * 10) .toString () + Math.floor (Math.random () * 10) .toString () + Math.floor (Math.random () * 10). toString ();
var array = (address + birthday + s) .split ("");
var total = 0;
for (i in array) {
total = total + parseInt (array [i]) * parseInt (coefficientArray [i]);
}
var lastNumber = lastNumberArray [parseInt (total% 11)];
var id_no_String = address + birthday + s + lastNumber;
var x = document.getElementsByName ("id_no");
for (var i = 0; i <x.length; i ++) {
var o = x [i];
o.value = id_no_String;
}
}
// Generate a random bank card number
function getBank_account () {
var bank_no = document.getElementById ("bank_no_select"). value;
var prefix = "";
switch (bank_no) {
case "0102":
prefix = "622202";
break;
case "0103":
prefix = "622848";
break;
case "0105":
prefix = "622700";
break;
case "0301":
prefix = "622262";
break;
case "104":
prefix = "621661";
break;
case "0303":
prefix = "622666";
break;
case "305":
prefix = "622622";
break;
case "0306":
prefix = "622556";
break;
case "0308":
prefix = "622588";
break;
case "0410":
prefix = "622155";
break;
case "302":
prefix = "622689";
break;
case "304":
prefix = "622630";
break;
case "309":
prefix = "622908";
break;
case "310":
prefix = "621717";
break;
case "315":
prefix = "622323";
break;
case "316":
prefix = "622309";
break;
default:
}
for (var j = 0; j <13; j ++) {
prefix = prefix + Math.floor (Math.random () * 10);
}
var x = document.getElementsByName ("bank_no");
for (var i = 0; i <x.length; i ++) {
var o = x [i];
o.value = bank_no;
}
var y = document.getElementsByName ("bank_account");
for (var i = 0; i <y.length; i ++) {
var o = y [i];
o.value = prefix;
}
}
Appendix:Click here for the complete instance codeDownload from this site.