progress scaling

Hello,
I think this is a feature request. I’d like the ability to scale from 0-100 rather than 0-1. I’m not sure if there could be like a gantt.config.progress_start and progress_end, or if it should be more like a template- but in any case, I’m having to cast from an integer percentage to a float and then back again, and it would just seem cleaner if Gantt could be configured to deal with this. Thanks for any ideas.

Hello,
Actually, progress has a floating value. Otherwise, it wouldn’t be so smooth when you drag it. If you need to show the progress in the grid or in the lightbox, maybe it is better to return a value with the percent like:
return Math.round(task.progress * 100) + “%”
and use the existing value in the calculations?
If there is something wrong, please share a sample of your code in the following snippet, so I can see what might be wrong:
https://snippet.dhtmlx.com/5/38ee1b370

I’m asking a question for clarity, and then making a feature request based on the state of the world as I understand it.

Part I, the question: Does gantt allow you to use a range for progress other than from 0.0-1.0, inclusive?

Part II: the feature request: assuming the answer to the above question is “no”, could one of two techniques be used to implement configuration for this item?

Approach 1: have a callback template for progress, so that users can write something like gantt.templates.progress = §=>{ return p/100; }

Approach 2: have configuration fields (e.g., gantt.config.progress_start=0 and gantt.config.progress_end=100).

Hello,

no, the range is fixed

you can format the progress value using templates, please check this snippet:
https://snippet.dhtmlx.com/t5ba0gzu?text=gantt.+progress

I’m not sure I fully understand your original question, however.
you mentioned that you have to cast the progress from an integer to a float and back - and I’m not sure I completely understand that part, can you pls clarify what exactly you implementing and how it works now?
If you need progress format for the UI, then you need only one formatting function as shown in the snippet, and shouldn’t be any need for converting progress value back. So, could you clarify?

I also had this problem. Our server had progress range from 0 to 100, I wanted to show this on gantt, the library received let’s say “40”, and it render the chart bars full to 100%… because it’s bigger than 1, I could not fix it.

And I had to convert manualy data when I send it back to the server from 0-1 range to 0-100.

Hello,
Gantt only accepts a progress value between 0 and 1.
So if the progress values ​​on your server are between 0 and 100, that means you need to convert your received data in Gantt and revert to original values when you send to the server.