<div id="container" style="width: 100%; height: 400px; margin: 0 auto"></div>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script language="JavaScript">
$(document).ready(function() {
var yuanjia = "${yuanjia}";
var xianjia = "${xianjia}";
var num_iid = "${tbk_item_info.num_iid}";
//alert(yuanjia + " - "+ xianjia);
//console.log(yuanjia);
//console.log(xianjia);
// 取两个数字将的随机数
function rnd(min, max){
var oneN = Math.round((Math.random() * (max - min) + min) * 9.5) / 10;
if(oneN < 0){
//console.log("fushu");
oneN = rnd(min, max);
}
return oneN;
}
// 将原价加10,分7档
var ceil_yj = Math.ceil( (Math.ceil(yuanjia)+10) / 5 );
var yAs = [];
for(var i=0; i<5; i++){
yAs.push(ceil_yj * i);
}
console.log(yAs);
// 将现价
var xAs = [];
if($.cookie(num_iid+"_xAs") == undefined || $.cookie(num_iid+"_xAs") == 'NaN' || $.cookie(num_iid+"_xAs") == 'null'){
for(var i=0; i<3; i++){
xAs.push(rnd((Math.ceil(yuanjia)-10), xianjia));
}
xAs.push(parseFloat(xianjia));
$.cookie(num_iid+"_xAs",xAs);
}else{
xAs = $.cookie(num_iid+"_xAs").split(",").map(Number);
}
console.log(xAs);
var title = {
text: '最近三个月的价格'
};
var subtitle = {
text: 'Source: runoob.com'
};
var xAxis = {
categories: ['一月', '二月', '三月', '四月', '五月', '六月',
'七月', '八月', '九月', '十月', '十一月', '十二月']
};
var yAxis = {
title: {
text: 'Temperature (\xB0C)'
},
//tickPositions: [10, 20, 30, 40, 50, 60, 70, 80, 90, 100],
tickPositions: yAs,
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
};
var tooltip = {
valuePrefix: '¥'
//valueSuffix: '元',
};
var legend = {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 0
};
var series = [
{
name: '价格',
data: xAs,
marker: {
symbol: 'diamond'
},
}
/* ,
{
name: 'New York',
data: [-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8,
24.1, 20.1, 14.1, 8.6, 2.5]
},
{
name: 'Berlin',
data: [-0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6,
17.9, 14.3, 9.0, 3.9, 1.0]
},
{
name: 'London',
data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0,
16.6, 14.2, 10.3, 6.6, 4.8]
} */
];
var plotOptions= {
line: {
dataLabels: {
enabled: true,
}
}
};
var credits={
enabled:false
};
var json = {};
json.title = title;
json.subtitle = subtitle;
json.xAxis = xAxis;
json.yAxis = yAxis;
json.tooltip = tooltip;
json.legend = legend;
json.series = series;
json.plotOptions = plotOptions;
json.credits = credits;
$('#container').highcharts(json);
});
</script>
Highcharts JS去除Highcharts.com链接的方法
在js文件中找到Credits,然后把enable的属性从!0改为0。
也可以更改为自己需要的:
enabled:设置是否显示链接
text:设置链接显示的名称
href:设置链接的url
转载于:https://my.oschina.net/hehongbo/blog/1800864