Skip to content

Non-zero start values #121

@rbradcurtis

Description

@rbradcurtis

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();

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions