2016-08-07 5 views
0

http://jsbin.com/nadozi/edit?html,js,outputjQuery Kreis Progressbar beginnend 0 Wert zeigt falsch

Hier ist meine JSBin.

Ich versuche, den Kreis mit value = 0 zu initialisieren, aber es zeigt einen Punkt als Ausgangspunkt. Nur passiert, wenn lineCaprund ist. Wie kann ich es ausblenden und als leerer grauer Kreis beginnen, wenn ich einen neuen Kreis anlege?

Dies ist die Bibliothek Ich versuche zu verwenden: wie diese https://github.com/kottenator/jquery-circle-progress

+0

tut, beantworte deine Frage?? – bhansa

Antwort

0

Das Problem wurde identifiziert und bestätigt hier - GitHub - Issue #108

Die Abhilfe Zeichnung zu umgehen, wenn der Wert 0 ist auch gearbeitet:

drawArc: function(v) { 
    // introduced this value check so that arc is rendered only when value is > 0 
    if (this.getValue() > 0) { 
    var ctx = this.ctx, 
     r = this.radius, 
     t = this.getThickness(), 
     a = this.startAngle; 

    ctx.save(); 
    ctx.beginPath(); 

    if (!this.reverse) { 
     ctx.arc(r, r, r - t/2, a, a + Math.PI * 2 * v); 
    } else { 
     ctx.arc(r, r, r - t/2, a - Math.PI * 2 * v, a); 
    } 

    ctx.lineWidth = t; 
    ctx.lineCap = this.lineCap; 
    ctx.strokeStyle = this.arcFill; 
    ctx.stroke(); 
    ctx.restore(); 
    } 
} 
0

etwas? Früher habe ich die weitere Beispiele auf dieser Seite verlinkt http://kottenator.github.io/jquery-circle-progress/

$('.circle').circleProgress({ 
value: 1.0, 
fill: { color: '#ffa500' } 
}).on('circle-animation-progress', function(event, progress) { 
$(this).find('strong').html(parseInt(100 * progress) + '<i>%</i>'); 
});