久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何使用 jQuery 和 jQplot 為圖表制作動畫(更新數(shù)據(jù)

How to animate diagrams with jQuery and jQplot (updating data)(如何使用 jQuery 和 jQplot 為圖表制作動畫(更新數(shù)據(jù)))
本文介紹了如何使用 jQuery 和 jQplot 為圖表制作動畫(更新數(shù)據(jù))的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

隨著時間的推移,我通過更改數(shù)據(jù)并重新繪制它們來動畫化"圖表.

I am "animating" diagrams over time by changing the data and redrawing them.

// initialization
var data = ...
var targetPlot = $.jqplot('#diagram', data, diagramOptions);

現(xiàn)在一段時間后,我將以某種方式更改數(shù)據(jù)并希望更新圖表.以下解決方案有效:

Now after some time I will change the data in some way and want to update the diagram. The following solution works:

// update Data
targetPlot.data = ...;
// remove old diagram
$('#<%= "diagram" + diagram.id.to_s %>container').empty();
// redraw
targetPlot = $.jqplot('#diagram', data, diagramOptions);

這是一個完整的重繪.有大量數(shù)據(jù)和較短的時間間隔 jQPlot 會占用大量內(nèi)存并且圖表會閃爍.

Bit this is a complete redraw. With lots of data and a short intervall jQPlot takes much memory and the diagram is flickering.

如何正確地做到這一點?

How to do this correct?

對我來說使用redraw-function的解決方案只畫了舊圖:

The solution using the redraw-function for me only draws the old diagram:

// update Data
targetPlot.data = ...;
targetPlot.redraw();

推薦答案

這是我經(jīng)過大量調(diào)查后發(fā)現(xiàn)的方式.我寫下來是為了幫??助閱讀這個問題的人.

This is the way I found after lots of investigation. I am writing this down to help someone reading this question.

更新數(shù)據(jù)的正確位置在series屬性中,更新數(shù)據(jù)后可以重繪繪圖:

The correct place to update the data is in the series property, after updating the data you can redraw the plot:

targetPlot.series[0].data = myData;
targetPlot.redraw();

如果你的軸改變了,那么你可以使用 replot() 而不是 redraw() 來重新縮放它們:

If your axis changed, then you can rescale them by using replot() instead of redraw():

targetPlot.replot({resetAxes:true});

這比每次都重新繪制一個新圖要快得多.

This is much faster than redrawing a new plot every time.

這篇關(guān)于如何使用 jQuery 和 jQplot 為圖表制作動畫(更新數(shù)據(jù))的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

jQuery/JavaScript Library for avatar creation?(用于創(chuàng)建頭像的 jQuery/JavaScript 庫?)
How to do following mask input problem?(如何做以下掩碼輸入問題?)
Issues Setting Value/Label Using DropKick Javascript(使用 DropKick Javascript 設(shè)置值/標簽的問題)
how to unit-test private methods in jquery plugins?(如何對 jquery 插件中的私有方法進行單元測試?)
stellar.js - configuring offsets / aligning elements for a vertical scrolling website?(stellar.js - 為垂直滾動網(wǎng)站配置偏移量/對齊元素?)
jQuery masked input plugin. select all content when textbox receives focus(jQuery 屏蔽輸入插件.當(dāng)文本框獲得焦點時選擇所有內(nèi)容)
主站蜘蛛池模板: 午夜小视频在线观看 | 亚洲久久久 | 欧美精选一区二区 | 日本精品在线一区 | 亚洲一区亚洲二区 | av在线亚洲天堂 | 区一区二区三在线观看 | 国产视频一区二区三区四区五区 | 精品综合网 | 亚洲国产69 | 国产精品成人在线 | 亚洲精品综合 | 久久久久久久久久久久91 | 91在线视频国产 | 国产亚洲欧美在线 | 美女一级毛片 | 欧美xxxⅹ性欧美大片 | 亚洲国产黄色av | 欧美黄 片免费观看 | 中文字幕 在线观看 | 亚洲成人免费观看 | 日韩欧美中文字幕在线观看 | 日韩欧美二区 | 亚洲视频 欧美视频 | 中文字幕精品一区 | 中文字幕成人在线 | 欧美精品一区二区在线观看 | 一区二区三区四区电影视频在线观看 | 91精品久久久久久久久中文字幕 | 亚洲最大的黄色网址 | 欧美99| 我要看黄色录像一级片 | 日本 欧美 国产 | 3p视频在线观看 | 久久机热 | 午夜国产一级 | 91免费观看在线 | 久综合 | 国产一区二区三区久久久久久久久 | 99久久婷婷国产精品综合 | 日韩喷潮|