在一个已经渲染过的jquery flot图上绘制一个新系列 [英] Plot a new series on an already-rendered jquery flot graph

查看:69
本文介绍了在一个已经渲染过的jquery flot图上绘制一个新系列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个浮动图已经在渲染一个数据序列,即

I have a float graph that is already rendering one data series, i.e.

var plot = $.plot($('#placeholder'), [data1], options);

稍后,我将收到一些新数据,这些数据也要作为单独的数据系列绘制在同一张图上.有没有一种方法可以将这个新的数据系列添加到现有图形中,而不必再次构造整个图形?也就是说,我希望避免再打这样的电话:

At a later point, I will receive some new data that I want to also plot on this same graph, as a separate data series. Is there a way I can just add this new data series to the existing graph, and not have to construct the whole graph again? That is, I want to avoid having to make another call like this:

var plot = $.plot($('#placeholder'), [data1, data2], options);

,而是拨打这样的电话:

and instead make a call like this:

plot.addSeries([data2], option);

谢谢!

推荐答案

@Black Box Operations具有很好的常规细节.当您反复调用$.plot(...)时,最新版本(0.7)之前会出现内存泄漏问题.要么升级到最新版本,要么考虑进行plot.setData()plot.setupGrid()plot.draw()

@Black Box Operations has the general details quite well. There's some problems before the latest version (0.7) with memory leaks when you repeatedly call $.plot(...). Either upgrade to the latest version, or look into doing plot.setData(), plot.setupGrid() and plot.draw()

您可以从 API中获取setData,setupGrid和draw方法的详细信息. txt

这篇关于在一个已经渲染过的jquery flot图上绘制一个新系列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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