Alb*_*urg 3 google-visualization
我正在使用Google可视化的LineChart来显示一些数据(它可以正常工作).
的图表显示了性能试验的结果和那些结果应该不超过某个值(例如,响应时间应不超过20ms).Si我想绘制最大值(我猜的水平线),而不必添加新的(虚拟)数据系列.
那可能吗?
非常感谢,
阿尔班
不,你不能添加另一行而不添加另一系列数据,但你不必手动添加它 - 一个DataView就足以为你计算它:
var maxResponseTime = 20;
var view = new google.visualization.DataView(data);
view.setColumns([0, 1[, 2, 3, 4.... /* specify all of your existing columns here */, {
type: 'number',
calc: function () {
return maxResponseTime;
}
}]);
var chart = new google.visualization.LineChart(...);
chart.draw(view, {
// options
series: {
// "n" should be the series index of the max line
// typically this is column index - 1,
// so if you have one domain column, one data series
// and the max line, it would be:
1: {
visibleInLegend: false, // set this if you don't want it in the legend
enableInteractivity: false // set this if you don't want the line to spawn tooltips
}
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10300 次 |
| 最近记录: |