gpt4 book ai didi

google-visualization - 向 Google 图表的 LineChart 添加水平引用线

转载 作者:行者123 更新时间:2023-12-01 09:59:43 27 4
gpt4 key购买 nike

我正在使用 Google visualization's LineChart 来显示一些数据(它有效)。

该图表显示了性能测试结果,这些结果不应超过某个值(例如,响应时间不应超过 20 毫秒)。 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
}
}
});

关于google-visualization - 向 Google 图表的 LineChart 添加水平引用线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17988266/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com