473,419 Members | 1,527 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 473,419 developers and data experts.

svg implementation of circular progress bar

html
matters needing attention:
viewBox fill canvas;
:stroke-dasharray Perimeter;
:stroke-dashoffset Proportion of non transparency;
Expand|Select|Wrap|Line Numbers
  1. <svg :width="size"
  2.              :height="size"
  3.              viewBox="0 0 100 100">
  4.             <!-- bgc -->
  5.             <circle r="50" cx="50" cy="50"
  6.                     fill="transparent"
  7.                     ref="pbgc"
  8.                     class="progress-bgc"></circle>
  9.             <!-- bar -->
  10.             <circle r="50" cx="50" cy="50"
  11.                     fill="transparent"
  12.                     ref="pbar"
  13.                     :stroke-dasharray="dashArray"
  14.                     :stroke-dashoffset="dashOffset"
  15.                     class="progress-bar"></circle>
  16.         </svg>
  17.  
css
matters needing attention:
Transform-origin Operate by Center;
Transform:route(-90deg) Rotate 90°CCW;
Expand|Select|Wrap|Line Numbers
  1. circle {
  2.         stroke-width: 6px;
  3.         transform-origin: center;
  4.     }
  5.  
  6.     .progress-bgc {
  7.         transform: scale(0.9);
  8.         /*stroke: rgba(66, 66, 66, 0.5);*/
  9.     }
  10.  
  11.     .progress-bar {
  12.         /*stroke: rgb(66, 66, 66);*/
  13.         transform: rotate(-90deg) scale(0.9);
  14.     }
  15.  
js
The following is the property value passed in through the tag setting property:
Expand|Select|Wrap|Line Numbers
  1.             size: {
  2.                 type: Number,
  3.                 default: 100
  4.             },
  5.             percent:{
  6.                 type:Number,
  7.                 default:0
  8.             },
  9.  
Perimeter and incoming progress are calculated:
Expand|Select|Wrap|Line Numbers
  1. data(){
  2.             return{
  3.                 dashArray:Math.PI * 2 * 50
  4.             }
  5.         },
  6.         computed:{
  7.             dashOffset(){
  8.                 return (1 - this.percent) * this.dashArray //  clockwise,it is necessary to take the anti operation
  9.             }
  10.         }
  11.  
Jun 24 '21 #1
0 5529

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: ernesto basc?n pantoja | last post by:
Hi everybody: I'm implementing a general C++ framework and I have a basic question about circular dependencies: I am creating a base class Object, my Object class has a method defined as:...
16
by: Kiuhnm | last post by:
Is there an elegant way to deal with semi-circular definitions? Semi-circular definition: A { B }; B { *A }; Circular reference: A { *B }; B { *A }; The problems arise when there are more...
4
by: Henke | last post by:
I have this scenario. public class A { public int numbers; public class A() { }
2
by: William Stacey | last post by:
Working with implementing a circular buffer for a producer/consumer deal. Have not done one in a while. The following seems to work. However, I remember and have seen other implementation that...
6
by: Kyle | last post by:
I want to do a single pix update bar instead of the big block that progress bars usually use. I can't seem to find any info on how to do this. Thanks in advance for any help, Kyle
23
by: Rogers | last post by:
I want to compare strings of numbers that have a circular boundary condition. This means that the string is arranged in a loop without an end-of-string. The comparaison of two strings now...
2
by: randy1200 | last post by:
In SQL Reporting Services, there's a circular green progress bar. Looks just like the regular progress bar in the toolbar, except that it's a circle. It's perfect for when a Win Form client needs...
7
by: toton | last post by:
Hi, I want a circular buffer or queue like container (queue with array implementation). Moreover I want random access over the elements. And addition at tail and remove from head need to be low...
20
by: Luc Kumps | last post by:
(Sorry about the previous post, it got transmitted before it was complete) We try to separate implementation and interface defintions, but we run into a problem. I hope the guru's can solve this,...
1
by: Carl Ganz | last post by:
I have an EXE that calls a method in a DLL. This DLL runs an import process and needs to provide feedback to a progress bar on a Form in the EXE. I can set a reference to the DLL from the EXE so...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.