English 中文(简体)
转 转 转 转
原标题:Transition flickering

I see a strange flickering effect after a transition. It is unusual mainly because I do not set the opacity in any way (I want the color to remain the same). Any ideas why this happens? To have an idea about how the code looks like, here is an example.

var theBars = this.vis.selectAll(".bar" + source.id).data(this.columns);

theBars.enter().insert("svg:rect")
       //some attributes
        .style("fill", sourceColor)
        //some other attributes

theBars.transition()
        //.duration(.01)
        .attr("y", function(d) {
                return this.settings.base - this.getStackedBarHeight(d, source.id);
            }.bind(this))
        .attr("height", function(d) {
                return this.getBarHeight(d.counters[source.id]);
            }.bind(this));

As it can be seen only one line sets the color. I initially tought I made some mistakes at binding, but after checking some posts here and on Google Groups, I discovered that this flickering usually appears when you have transitions that also change the opacity of the object. Unfortunately I don t change any opacity, I just make a transition. This effect appears in all major browsers when executing that transition (theBars.transition).

我试着从堆叠的栏杆中选择一个栏杆,修改其高度。

问候您了!

最佳回答

为了解决这个问题,我增加了两件事:

  1. in the init phase - I added all the bars but with all counters set on 0;
  2. 在提款阶段 -- -- 我添加了这个代码:

    var theBars = this.vis.selectAll("#bar_"+index+"_"+currentIndex);
    
    this.settings.sources.each(function(pair) {
         theBars
             .style("fill", source.color)
             .attr("height", this.getBarHeight(source.id)
             .attr("y", this.settings.size.baseLine - this.getStackedBarHeight(counters, source.id))
    }, this);
    

转型带来的幻觉已经过去,因为我们在这里没有转型。 仍然有些情况我们需要转型,例如,我们用同一个词有几个条条,但在那里,我通过真正快速的(.期限(1)或更少的)解决了这种闪烁。

问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签