如何在渲染时抑制D3或MetricsGraphics动画

时间:2018-04-18 16:42:22

标签: d3.js

我使用MetricsGraphics库和D3绘制curveStep时间序列图。当附加数据可用时,将重绘图。

下面是代码,这里是小提琴:https://jsfiddle.net/5kbr5mk5/

var mydata = [];
var intervalID = setInterval( function addsample() {
var newval = Math.random() * 10;
var mysample = { 
    timestamp: new Date(), 
    value: newval };
mydata.push( mysample );
console.log("sample count: " + mydata.length);
if (mydata.length == 100) clearInterval(intervalID);

MG.data_graphic({
title: "Time Series Plot",
data: mydata,
    interpolate: d3.curveStep,
    chart_type: 'line',
height: 400,
width: 600,
xax_count: 3,
x_accessor: 'timestamp',
y_accessor: 'value',
area: false,
target: '#chart'
});},1000);

当剧情正在更新时,奇怪的动画(变形)来自何处,我该如何抑制它?

1 个答案:

答案 0 :(得分:2)

py.plot参数更改为transition_on_update

false

https://jsfiddle.net/5kbr5mk5/16/