Google可视化注释时间线,删除数据点 [英] Google Visualization Annotated Time Line, removing data points

查看:155
本文介绍了Google可视化注释时间线,删除数据点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图建立一个图表,根据你放大的距离来改变分辨率。下面是你完成缩小时的样子。




所以这看起来不错,所以当我放大时,我得到一个更高分辨率的数据我的图表如下所示:




问题是,当我缩小更高分辨率的数据没有从图表中清除时:



图表下方的表格显示DataTable中的内容。这是绘图代码的样子。

  var g_graph = new google.visualization.AnnotatedTimeLine(document.getElementById('graph_div_json') ); 
var table = new google.visualization.Table(document.getElementById('table_div_json'));
函数handleQueryResponse(响应){
log(绘图图表)
var data = response.getDataTable()
g_graph.draw(data,{allowRedraw:true,thickness: 2,fill:50,scaleType:'maximized'})
table.draw(data,{allowRedraw:true})
}

我试图找到一种方法让它仅显示DataTable中的数据。我尝试删除allowRedraw标志,但随后它打破了缩放操作。



任何帮助将不胜感激。



感谢

参见




解决方案

在我看来,最好的解决方案是绘制每一个 nth 取决于你的缩放级别。在Google财经图表上,缩放级别在上面预先确定:1米,5米,1小时,1天,5天等。看起来很明显,这正是谷歌正在做的。在最大值视图级别,他们绘制的月份为点。如果你每天投票1000次(每次投票产生一个单一的点数),那么你会获得每个点的第3万点(第1个点是第一个月的第一个点),并且第3万个是最后一点)。

这些缩放级别中的每一个都会实现不同的数据点图。每个点都应该有一个精确到第二个的时间标记,所以您可以轻松地根据详细程度来缩放绘图。


I am trying to build a graph that will change resolution depending on how far you are zoomed in. Here is what it looks like when you are complete zoomed out.

So this looks good so when I zoom in I get a higher resolution data and my graph looks like this:

The problem is when I zoom out the higher resolution data does not get cleared out of the graph:

The tables below the graphs are table display what is in the DataTable. This is what drawing code looks like.

var g_graph = new google.visualization.AnnotatedTimeLine(document.getElementById('graph_div_json'));
var table = new google.visualization.Table(document.getElementById('table_div_json'));
function handleQueryResponse(response){
    log("Drawing graph")
    var data = response.getDataTable()
    g_graph.draw(data, {allowRedraw:true, thickness:2, fill:50, scaleType:'maximized'})
    table.draw(data, {allowRedraw:true})
}

I am try to find a way for it to only displaying the data that is in the DataTable. I have tried removing the allowRedraw flag but then it breaks the zooming operation.

Any help would be greatly appreciated.

Thanks

See also

解决方案

It seems to me that the best solution would be to draw every nth data point, depending on your level of zoom. On the Google Finance graph(s), the zoom levels are pre-determined at the top: 1m, 5m, 1h, 1 day, 5 days, etc. It seems evident that this is exactly what Google is doing. At the max view level, they're plotting points that fall on the month. If you're polling 1000 times a day (with each poll generating a single point), then you'd be taking every 30,000th point (the fist point being the very first one of the month, and the 30,000th one being the last point).

Each of these zoom levels would implement a different plot of the data points. Each point should have a time stamp with accuracy to the second, so you'll easily be able to scale the plot based on the level of detail.

这篇关于Google可视化注释时间线,删除数据点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆