简体   繁体   English

将文本添加到Angular SVG Round Progress Bar

[英]Adding text to Angular SVG Round Progress Bar

So I'm using Cris Beto's Angular SVG Round Progress Bar to... create a round progress bar. 因此,我使用Cris Beto的Angular SVG圆形进度条来...创建圆形进度条。 Anyway, I want to add text to the center of it, like the demo . 无论如何,我想像演示一样在其中心添加文本。 I've tried just adding the text between the divs, and also going into the source code on the demo page to try to figure it out and I haven't been able to figure it out. 我试过只是在div之间添加文本,还进入演示页面上的源代码以尝试找出它,但我一直无法弄清楚。

I've basically followed his directions exactly to get a working bar graph with animation. 我基本上完全按照他的指示进行操作,以获得带有动画的工作条形图。 Any ideas? 有任何想法吗?

Just in case, here's my HTML: 以防万一,这是我的HTML:

        <div id="circleGraph" class="container-fluid">
        <div
            round-progress
            max="200"
            current="100"
            color="#45ccce"
            bgcolor="#eaeaea"
            radius="100"
            stroke="30"
            semi="false"
            rounded="true"
            clockwise="true"
            responsive="false"
            duration="800"
            animation="easeInOutQuart">
        </div>
    </div>

This is probably a day late and a dollar short, but it stumped me as well until I dug further. 这可能是一天的迟到,又缺了1美元,但在我进一步挖掘之前,它也使我感到沮丧。 Here is how they are doing it ... and this is my implementation: 这是他们的做法...这是我的实现:

<style>
.progress-percentage-wrapper {
    position: relative;
    margin: 20px auto;
    font-size: 50px;
    width: 200px;
    height: 200px;
}
.progress-percentage {
    position: absolute;
    color: #bbb;
    width: 100%;
    text-align: center !important;
    top: 35%;
}
</style>

<div class="progress-percentage-wrapper">
        <div class="progress-percentage ng-cloak">{{vm.percentageOfGoal | percentage:0}}</div>
            <round-progress max="1"
                        current="vm.percentageOfGoal"
                        color="#45ccce"
                        bgcolor="#eaeaea"
                        radius="100"
                        stroke="20"
                        semi="false"
                        rounded="false"
                        clockwise="true"
                        responsive="false"
                        duration="1000"
                        animation="easeInOutQuart"
                        animation-delay="500"></round-progress>
        </div>
    </div>

This is how I implemented it in my project: 这就是我在项目中实现它的方式:

<div class="positionRelative">

    <round-progress
        max="100"
        current="[[myValue.percentage]]"
        color="#4AB7EC"
        bgcolor="#56606B"
        radius="35"
        stroke="5"
        semi="false"
        rounded="false"
        clockwise="true"
        responsive="false"
        duration="800"
        animation="easeInOutQuart"
        animation-delay="0"></round-progress>

        <div class="percentageValue">
            20 % // text that comes in cetner
        </div>

</div>

And the CSS: 和CSS:

.positionRelative{
    position: relative;

}

.percentageValue {
    left: 10px;
    top: 40%;
    position: absolute;
    width: 100%;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM