Our state of the art Gantt chart


Post by jhughesoneplan »

I am having issues with javascript and long decimals. The issue is that if you do effort driven, and fixed effort. If you have a long task with small effort you have a small decimal like 7.12334% for instance in the units of an assignment. I don't need that accuracy, so is there a way to truncate or set the number of decimals for units?


Post by marcio »

Best regards,
Márcio


Post by jhughesoneplan »

I am trying to apply to an assignment unit not effort. Does this translate over?


Post by marcio »

Hey jhughesoneplan,

Sorry, my mistake. If I understood correctly, you're trying to set the assignment unit to not have too many decimals, you can achieve that by using the following snippet (the minimum/maximum values are just for example, you can change as your wish)

features : {
        taskEdit : {
            items : {
                resourcesTab : {
                    items : {
                        grid : {
                            columns : {
                                // Columns are held in a store, thus it uses `data`
                                // instead of `items`
                                data : {
                                    units : {
                                        format : {
                                            minimumFractionDigits : 0,
                                            maximumFractionDigits : 2
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

You can check the documentation here https://bryntum.com/products/gantt/docs/api/Core/widget/NumberField#config-format for more information.

If it's not what you're looking for, could you provide more context and maybe some screenshots of where you want to change?

Best regards,
Márcio


Post by jhughesoneplan »

That would be effecting the task edit. I need the setting global. The issue is if you have a long duration task say 113 days and then say set the effort to 1 hour. Your units decimal is 0.11061946902654868. This causes an issue especially since javascript has issues handling large decimals. I want that truncated to 2 decimals in my case.


Post by alex.l »

Hi jhughesoneplan,

Not sure I got the point. If you round value, it won't be equal to 1 hour. If you only want to change it visually, you'll need to set all places in UI where this value appears. What's your plan?

All the best,
Alex


Post Reply