52,787
社区成员




$(function () {
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container3',
plotBorderWidth: 1,
zoomx:true,
type: 'line'
},
title: {
text: null
},
credits:{
enabled:false,
position: {
align: 'left',
x: 350,
verticalAlign: 'bottom'
}
},
legend: {
enabled:true
},
xAxis: {
type: 'datetime',
min:minDate, //0表示1月 以此类推
max:maxDate,
tickInterval :30*24*3600*1000,//X轴点间隔
labels: {
align: 'left',
formatter: function() {
return Highcharts.dateFormat('%Y%m%d', this.value);
}
}
},
yAxis: [
{
lineWidth:1,
// gridLineColor: 'red',
gridLineDashStyle: 'shortdash',
max:maxYield*100,
min:-maxYield*100,
opposite: true,
tickInterval:(maxYield*100/3),
title: {
text: null
},
labels: {
formatter: function() {
return this.value +'%';
}
}
},
{
lineWidth:1,
// gridLineColor: 'red',
gridLineDashStyle: 'shortdash',
max:1500,
min:-1500,
//opposite: true,
//tickInterval:500,
title: {
text: null
},
labels: {
formatter: function() {
return this.value ;
}
}
}
],
tooltip: {
formatter: function() {
return this.series.name+'<br/><strong>日期:</strong>'+
Highcharts.dateFormat('%Y%m%d', this.x) +'<strong>收益率:</strong> '+ this.y+'%' ;
}
},
plotOptions: {
line: {
dataGrouping: {
enabled: false
}
},
series: {
lineWidth:1,
marker: {
radius: 1 //鼠标接触时 显示点的大小
}
}
},
series: strategys
});
});
window.weeklyChart = new Highcharts.Chart({
chart: {
renderTo: 'week_trategy_container',
plotBorderWidth: 1,
// height: 600,
// width:1000,
type: 'line'
},
title: {
text: null
},
credits:{
enabled:false,
position: {
align: 'left',
x: 350,
verticalAlign: 'bottom'
}
},
legend: {
enabled:true
},
xAxis: {
type: 'datetime',
min:weekminDate, //0表示1月 以此类推
max:weekmaxDate,
tickInterval :20*24*3600*1000,//X轴点间隔
labels: {
//align: 'left',
formatter: function() {
return Highcharts.dateFormat('%Y-%m-%d', this.value);
}
}
},
yAxis: [
{
lineWidth:1,
// gridLineColor: 'red',
//endOnTick : true,
gridLineDashStyle: 'shortdash',
max:weekmaxYield,
min:-weekmaxYield,
opposite: true,
tickInterval:week_pre_Yield,
title: {
text: '收益率(%)'
},
labels: {
formatter: function() {
if (this.value >0) {
return '<span style="fill: red;">' + this.value + '</span>';
}
else if(this.value <0){
return '<span style="fill: green;">' + -(this.value) + '</span>';
}
else {
return this.value;
}
}
}
},
{
lineWidth:1,
// gridLineColor: 'red',
gridLineDashStyle: 'shortdash',
max:weekmaxYield,
min:-weekmaxYield,
tickInterval:week_pre_Yield,
title: {
text:'资金(万)'
},
labels: {
formatter: function() {
return (this.value*weekInitCapital+weekInitCapital).toFixed(0)
}
}
}
],
tooltip: {
formatter: function() {
return this.series.name+'<br/><strong>日期:</strong>'+
Highcharts.dateFormat('%Y%m%d', this.x) +'<strong>XXX:</strong> '+ this.y+'%' ;
}
},
plotOptions: {
line: {
dataGrouping: {
enabled: false
}
},
series: {
lineWidth:1,
marker: {
radius: 1 //鼠标接触时 显示点的大小
}
}
},
series: weekstrategys
});
$.qicLoading({remove: true});//移除loading。。。
});
yAxis: {
plotLines: [{
width: 2,
value: 0,
id: 'plotline-1'
}]
},
2.Y轴正数的颜色是红的,负数颜色是绿的
yAxis: [
{
lineWidth:1,
// gridLineColor: 'red',
gridLineDashStyle: 'shortdash',
max:maxYield*100,
min:-maxYield*100,
opposite: true,
tickInterval:(maxYield*100/3),
title: {
text: null
},
labels: {
formatter: function() {
//注意改的是这里!!!!!!
if (this.value >0) {
return '<span style="fill: red;">' + this.value +'%'; + '</span>';
else if(this.value <0){
return '<span style="fill: green;">' + this.value +'%'; + '</span>';
} else {
return this.value +'%';
}
}
}
},
{
lineWidth:1,
// gridLineColor: 'red',
gridLineDashStyle: 'shortdash',
max:1500,
min:-1500,
//opposite: true,
//tickInterval:500,
title: {
text: null
},
labels: {
formatter: function() {
//注意改的是这里!!!!!!
if (this.value >0) {
return '<span style="fill: red;">' + this.value; + '</span>';
else if(this.value <0){
return '<span style="fill: green;">' + this.value; + '</span>';
} else {
return this.value;
}
}
}
}
],