Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-zero start values #121

Closed
rbradcurtis opened this issue Apr 18, 2022 · 2 comments
Closed

Non-zero start values #121

rbradcurtis opened this issue Apr 18, 2022 · 2 comments
Labels

Comments

@rbradcurtis
Copy link

My use case is tracking progress of a task with meaningful values that don't begin at zero. e.g., starts at element #1000 and completes at element #1100. If I apply 1000 as the start point and 1100 as the total value, my expectation is that when value is 1001 the progress bar would be a 1% and the percent complete would be at 1%. To the contrary, the calculations seem to be based off a 0 starting point. Is there an option to track completion against an arbitrary (non-zero) starting point?

EXAMPLE:

const cliProgress = require('cli-progress');

// create a new progress bar instance and use shades_classic theme
const bar1 = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);

// start the progress bar with a total value of 200 and start value of 0
bar1.start(1100, 1000);

for (var i = 1000; i<=1100; i++) {
> //do something
> 
> // update the current value in your application..
> bar1.increment();
}

// stop the progress bar
bar1.stop();
@AndiDittrich
Copy link
Member

you have to use a custom payload for the value and normalize the progress to a zero-starting value.

@AndiDittrich
Copy link
Member

progressCalculationRelative has been added

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants