修复打印字体不显示问题以及格式化时间展示

This commit is contained in:
tanghao
2019-01-03 18:11:00 +08:00
parent 3c28bb7514
commit f7795f7172
10 changed files with 188 additions and 26 deletions

View File

@@ -190,6 +190,18 @@
}, },
min:0 min:0
}, },
tooltip: {
dateTimeLabelFormats: {
millisecond: '%Y-%m-%d %H:%M:%S',
second: '%Y-%m-%d %H:%M:%S',
minute: '%Y-%m-%d %H:%M:%S',
hour: '%Y-%m-%d %H:%M:%S',
day: '%Y-%m-%d %H:%M:%S',
week: '%Y-%m-%d %H:%M:%S',
month: '%Y-%m-%d %H:%M:%S',
year: '%Y-%m-%d %H:%M:%S'
}
},
credits : {//是否有highcharts水印 credits : {//是否有highcharts水印
enabled : false enabled : false
}, },

View File

@@ -162,6 +162,18 @@ function showActionTransChart(xData,series){
}, },
min:0 min:0
}, },
tooltip: {
dateTimeLabelFormats: {
millisecond: '%Y-%m-%d %H:%M:%S',
second: '%Y-%m-%d %H:%M:%S',
minute: '%Y-%m-%d %H:%M:%S',
hour: '%Y-%m-%d %H:%M:%S',
day: '%Y-%m-%d %H:%M:%S',
week: '%Y-%m-%d %H:%M:%S',
month: '%Y-%m-%d %H:%M:%S',
year: '%Y-%m-%d %H:%M:%S'
}
},
credits:{//是否有highcharts水印 credits:{//是否有highcharts水印
enabled:false enabled:false
}, },

View File

@@ -449,7 +449,17 @@ function protocolTypeChart(rs){
}, },
tooltip: { tooltip: {
headerFormat: '{series.name}<br>', headerFormat: '{series.name}<br>',
pointFormat: '{point.name}: <b>{point.percentage:.2f}%</b>' pointFormat: '{point.name}: <b>{point.percentage:.2f}%</b>',
dateTimeLabelFormats: {
millisecond: '%Y-%m-%d %H:%M:%S',
second: '%Y-%m-%d %H:%M:%S',
minute: '%Y-%m-%d %H:%M:%S',
hour: '%Y-%m-%d %H:%M:%S',
day: '%Y-%m-%d %H:%M:%S',
week: '%Y-%m-%d %H:%M:%S',
month: '%Y-%m-%d %H:%M:%S',
year: '%Y-%m-%d %H:%M:%S'
}
}, },
series: [{ series: [{
name: "App", name: "App",

View File

@@ -158,6 +158,18 @@ function showDomainTrans(xData,series){
legend: { legend: {
enabled:false enabled:false
}, },
tooltip: {
dateTimeLabelFormats: {
millisecond: '%Y-%m-%d %H:%M:%S',
second: '%Y-%m-%d %H:%M:%S',
minute: '%Y-%m-%d %H:%M:%S',
hour: '%Y-%m-%d %H:%M:%S',
day: '%Y-%m-%d %H:%M:%S',
week: '%Y-%m-%d %H:%M:%S',
month: '%Y-%m-%d %H:%M:%S',
year: '%Y-%m-%d %H:%M:%S'
}
},
plotOptions: { plotOptions: {
series: { series: {
lineWidth:1, lineWidth:1,

View File

@@ -250,8 +250,19 @@ function showIpActiveChart(xData,series){
} }
}, },
tooltip: { tooltip: {
pointFormat: '<b><spring:message code="ip"/>:</b>{series.name} <b><spring:message code="count"/>:</b>{point.y}<br/>' pointFormat: '<b><spring:message code="ip"/>:</b>{series.name} <b><spring:message code="count"/>:</b>{point.y}<br/>',
}, dateTimeLabelFormats: {
millisecond: '%Y-%m-%d %H:%M:%S',
second: '%Y-%m-%d %H:%M:%S',
minute: '%Y-%m-%d %H:%M:%S',
hour: '%Y-%m-%d %H:%M:%S',
day: '%Y-%m-%d %H:%M:%S',
week: '%Y-%m-%d %H:%M:%S',
month: '%Y-%m-%d %H:%M:%S',
year: '%Y-%m-%d %H:%M:%S'
}
},
yAxis: { yAxis: {
title: { title: {
text: 'bytes' text: 'bytes'

View File

@@ -188,6 +188,18 @@ function showPortActiveChart(xData,series){
text: 'bytes' text: 'bytes'
} }
}, },
tooltip: {
dateTimeLabelFormats: {
millisecond: '%Y-%m-%d %H:%M:%S',
second: '%Y-%m-%d %H:%M:%S',
minute: '%Y-%m-%d %H:%M:%S',
hour: '%Y-%m-%d %H:%M:%S',
day: '%Y-%m-%d %H:%M:%S',
week: '%Y-%m-%d %H:%M:%S',
month: '%Y-%m-%d %H:%M:%S',
year: '%Y-%m-%d %H:%M:%S'
}
},
credits:{//是否有highcharts水印 credits:{//是否有highcharts水印
enabled:false enabled:false
}, },

View File

@@ -442,8 +442,18 @@ function protocolTypeChart(rs){
}, },
tooltip: { tooltip: {
headerFormat: '{series.name}<br>', headerFormat: '{series.name}<br>',
pointFormat: '{point.name}: <b>{point.percentage:.2f}%</b>' pointFormat: '{point.name}: <b>{point.percentage:.2f}%</b>',
}, dateTimeLabelFormats: {
millisecond: '%Y-%m-%d %H:%M:%S',
second: '%Y-%m-%d %H:%M:%S',
minute: '%Y-%m-%d %H:%M:%S',
hour: '%Y-%m-%d %H:%M:%S',
day: '%Y-%m-%d %H:%M:%S',
week: '%Y-%m-%d %H:%M:%S',
month: '%Y-%m-%d %H:%M:%S',
year: '%Y-%m-%d %H:%M:%S'
}
},
series: [{ series: [{
name: "Protocol", name: "Protocol",
colorByPoint: true, colorByPoint: true,

View File

@@ -535,7 +535,17 @@ function webTypeChart(rs){
}, },
tooltip: { tooltip: {
headerFormat: '{series.name}<br>', headerFormat: '{series.name}<br>',
pointFormat: '{point.name}: <b>{point.percentage:.2f}%</b>' pointFormat: '{point.name}: <b>{point.percentage:.2f}%</b>',
dateTimeLabelFormats: {
millisecond: '%Y-%m-%d %H:%M:%S',
second: '%Y-%m-%d %H:%M:%S',
minute: '%Y-%m-%d %H:%M:%S',
hour: '%Y-%m-%d %H:%M:%S',
day: '%Y-%m-%d %H:%M:%S',
week: '%Y-%m-%d %H:%M:%S',
month: '%Y-%m-%d %H:%M:%S',
year: '%Y-%m-%d %H:%M:%S'
}
}, },
series: [{ series: [{
name: "Domain", name: "Domain",

View File

@@ -285,9 +285,11 @@ License: www.highcharts.com/license
downloadJPEG: { downloadJPEG: {
textKey: "downloadJPEG", textKey: "downloadJPEG",
onclick: function () { onclick: function () {
this.legend.itemStyle.color='#000000'
this.exportChartLocal({ this.exportChartLocal({
type: "image/jpeg" type: "image/jpeg"
}) })
this.legend.itemStyle.color='#ffffff'
} }
}, },
downloadSVG: { downloadSVG: {

View File

@@ -4,10 +4,66 @@
chart: { chart: {
events: { events: {
beforePrint: function () { beforePrint: function () {
chart_main.xAxis[0].update({
labels:{
style:{
color:'#000000'
}
}
})
chart_3.xAxis[0].update({
labels:{
style:{
color:'#000000'
}
}
})
chart_main.yAxis[0].update({
labels:{
style:{
color:'#000000'
}
}
})
chart_3.yAxis[0].update({
labels:{
style:{
color:'#000000'
}
}
})
$('.highcharts-legend text').css('color','#000000'); $('.highcharts-legend text').css('color','#000000');
$('.highcharts-legend text').css('fill','#000000'); $('.highcharts-legend text').css('fill','#000000');
}, },
afterPrint: function () { afterPrint: function () {
chart_3.xAxis[0].update({
labels:{
style:{
color:'#ffffff'
}
}
})
chart_main.xAxis[0].update({
labels:{
style:{
color:'#ffffff'
}
}
})
chart_main.yAxis[0].update({
labels:{
style:{
color:'#ffffff'
}
}
})
chart_3.yAxis[0].update({
labels:{
style:{
color:'#ffffff'
}
}
})
$('.highcharts-legend text').css('color','#ffffff'); $('.highcharts-legend text').css('color','#ffffff');
$('.highcharts-legend text').css('fill','#ffffff'); $('.highcharts-legend text').css('fill','#ffffff');
} }
@@ -67,6 +123,9 @@
allowHTML:true, allowHTML:true,
filename:'Protocol-Type'+addDateName(), filename:'Protocol-Type'+addDateName(),
chartOptions: { chartOptions: {
chart:{
backgroundColor: 'rgba(255, 255, 255, 1)'
},
plotOptions: { plotOptions: {
series: { series: {
dataLabels: { dataLabels: {
@@ -240,7 +299,7 @@
data: [pktNum,byteLen], data: [pktNum,byteLen],
});*/ });*/
}); });
var chart = Highcharts.chart('chart_main', { chart_main = Highcharts.chart('chart_main', {
chart: { chart: {
backgroundColor: 'rgba(255, 255, 255, 0)', backgroundColor: 'rgba(255, 255, 255, 0)',
plotBackgroundColor:null, plotBackgroundColor:null,
@@ -268,25 +327,25 @@
series: { series: {
dataLabels: { dataLabels: {
enabled: true, enabled: true,
allowOverlap: true, // 允许数据标签重叠 color:'#000000'
color:'#000000'
},
},
xAxis: [{
labels: {
style: {
color: '#000000'
}
} }
}], }
yAxis: [{ },
labels: { xAxis: [{
style: { categories: xData,
color: '#000000' labels: {
} style: {
color: '#000000'
} }
}] }
} }],
yAxis: [{
labels: {
style: {
color: '#000000'
}
}
}]
}, },
buttons: { buttons: {
contextButton: { contextButton: {
@@ -491,7 +550,7 @@
data: [pktNum,byteLen], data: [pktNum,byteLen],
});*/ });*/
}); });
var chart = Highcharts.chart('chart_3',{ chart_3 = Highcharts.chart('chart_3',{
chart: { chart: {
backgroundColor: 'rgba(255, 255, 255, 0)', backgroundColor: 'rgba(255, 255, 255, 0)',
plotBackgroundColor:null, plotBackgroundColor:null,
@@ -524,7 +583,7 @@
} }
}, },
xAxis: [{ xAxis: [{
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], categories: xData,
labels: { labels: {
style: { style: {
color: '#000000' color: '#000000'
@@ -691,6 +750,9 @@ function echart_2(rs){
allowHTML:true, allowHTML:true,
filename:'BS'+addDateName(), filename:'BS'+addDateName(),
chartOptions: { chartOptions: {
chart:{
backgroundColor: 'rgba(255, 255, 255, 1)'
},
plotOptions: { plotOptions: {
series: { series: {
dataLabels: { dataLabels: {
@@ -844,6 +906,9 @@ function echart_5(rs){
allowHTML:true, allowHTML:true,
filename:'BS'+addDateName(), filename:'BS'+addDateName(),
chartOptions: { chartOptions: {
chart:{
backgroundColor: 'rgba(255, 255, 255, 1)'
},
plotOptions: { plotOptions: {
series: { series: {
dataLabels: { dataLabels: {
@@ -992,6 +1057,9 @@ function echart_4(rs){
allowHTML:true, allowHTML:true,
filename:'Website'+addDateName(), filename:'Website'+addDateName(),
chartOptions: { chartOptions: {
chart:{
backgroundColor: 'rgba(255, 255, 255, 1)'
},
plotOptions: { plotOptions: {
series: { series: {
dataLabels: { dataLabels: {
@@ -1139,6 +1207,9 @@ function echart_6(rs){
allowHTML:true, allowHTML:true,
filename:'Website'+addDateName(), filename:'Website'+addDateName(),
chartOptions: { chartOptions: {
chart:{
backgroundColor: 'rgba(255, 255, 255, 1)'
},
plotOptions: { plotOptions: {
series: { series: {
dataLabels: { dataLabels: {