Google visualization 加速谷歌图表-ApacheTomcat5.5缓存
我有一些在ApacheTomcat5服务器上读取CSV的谷歌图表 加载需要很长时间(显示图表需要15秒) 有人知道我怎样才能加快速度吗 也许在Tomcat5.5上缓存 代码如下Google visualization 加速谷歌图表-ApacheTomcat5.5缓存,google-visualization,tomcat5.5,Google Visualization,Tomcat5.5,我有一些在ApacheTomcat5服务器上读取CSV的谷歌图表 加载需要很长时间(显示图表需要15秒) 有人知道我怎样才能加快速度吗 也许在Tomcat5.5上缓存 代码如下 function FwThroughputStacked(){ $.get("../Data_Access/Overall_Fortinet_DLUL_Throughput_Report.csv", function(csvString) { var arrayData = $.csv.toAr
function FwThroughputStacked(){
$.get("../Data_Access/Overall_Fortinet_DLUL_Throughput_Report.csv", function(csvString) {
var arrayData = $.csv.toArrays(csvString, {onParseValue: $.csv.hooks.castToScalar});
var data = new google.visualization.arrayToDataTable(arrayData);
var DLThroughputView = new google.visualization.DataView(data);
DLThroughputView.setColumns([0,1,2,3,4,5,6,7,8,9,10]);
var ULThroughputView = new google.visualization.DataView(data);
ULThroughputView.setColumns([0,11,12,13,14,15,16,17,18,19]);
var ULThroughputStackedOps = {
chartArea: {width: '80%', height: '75%'},
explorer: {actions: ["dragToZoom", "rightClickToReset"]},
isStacked: true,
hAxis: {title: data.getColumnLabel(0), minValue: data.getColumnRange(0).min, maxValue: data.getColumnRange(0).max, textStyle: {fontSize: 9}},
vAxis: {title: "Megabits/s", minValue: data.getColumnRange(11).min, maxValue: data.getColumnRange(11).max, textStyle: {fontSize: 10}},
legend: {position: 'top', maxLines: 10, textStyle: {fontSize: 9} },
};
var ULThroughputOps = {
chartArea: {width: '80%', height: '75%'},
explorer: {actions: ["dragToZoom", "rightClickToReset"]},
hAxis: {title: data.getColumnLabel(0), minValue: data.getColumnRange(0).min, maxValue: data.getColumnRange(0).max, textStyle: {fontSize: 9}},
vAxis: {title: "Megabits/s", minValue: data.getColumnRange(11).min, maxValue: data.getColumnRange(11).max, textStyle: {fontSize: 10}},
legend: {position: 'top', maxLines: 10, textStyle: {fontSize: 9} },
};
var DLThroughputOps = {
chartArea: {width: '80%', height: '75%'},
explorer: {actions: ["dragToZoom", "rightClickToReset"]},
hAxis: {title: data.getColumnLabel(0), minValue: data.getColumnRange(0).min, maxValue: data.getColumnRange(0).max, textStyle : {fontSize: 9}},
vAxis: {title: "Megabits/s", minValue: data.getColumnRange(1).min, maxValue: data.getColumnRange(1).max, textStyle : {fontSize: 10}},
legend: {position: 'top', maxLines: 10, textStyle: {fontSize: 9} },
};
var DLThroughputStackedOps = {
chartArea: {width: '80%', height: '75%'},
explorer: {actions: ["dragToZoom", "rightClickToReset"]},
isStacked: true,
hAxis: {title: data.getColumnLabel(0), minValue: data.getColumnRange(0).min, maxValue: data.getColumnRange(0).max, textStyle: {fontSize: 9}},
vAxis: {title: "Megabits/s", minValue: data.getColumnRange(1).min, maxValue: data.getColumnRange(1).max, textStyle: {fontSize: 10}},
legend: {position: 'top', maxLines: 10, textStyle: {fontSize: 9} },
};
var chart = new google.visualization.LineChart(document.getElementById('DLThroughput'));
chart.draw(DLThroughputView, DLThroughputOps);
var chart = new google.visualization.AreaChart(document.getElementById('DLThroughputStacked'));
chart.draw(DLThroughputView, DLThroughputStackedOps);
var chart = new google.visualization.AreaChart(document.getElementById('throughputStacked'));
chart.draw(ULThroughputView, ULThroughputStackedOps);
var chart = new google.visualization.LineChart(document.getElementById('throughput'));
chart.draw(ULThroughputView, ULThroughputOps);
});
}
动态图提供了更快的图表,而无需乱动缓存。我现在可以在一张纸上加载20个图表&它的加载速度比使用谷歌图表的单个图表快 动态图提供了更快的图表,而无需乱动缓存。我现在可以在一张纸上加载20个图表&它的加载速度比使用谷歌图表的单个图表快 您知道下载csv和运行上述功能需要多长时间吗?csv中有多少行?这是一个大的csv,由我们的一个系统每小时自动生成。CSV下载占用了大部分时间-因此我想知道我们是否可以缓存Google图表-因此它不会在每次刷新时重新加载,而是每小时重新加载。您可以从图表生成一个图像,并使用
Chart.getImageURI()
显示它,直到刷新时间——你知道下载csv和运行上面的功能需要多长时间吗?csv中有多少行?这是一个大的csv,由我们的一个系统每小时自动生成。CSV下载占用了大部分时间-因此我想知道我们是否可以缓存Google图表-因此它不会在每次刷新时重新加载,而是每小时重新加载。您可以从图表生成一个图像,并使用Chart.getImageURI()
显示它,直到该刷新为止--