web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / X property on label an...
Power Apps
Answered

X property on label and Text Input not correct in Gantt chart

(2) ShareShare
ReportReport
Posted on by 192 Season of Giving Solutions 2025
 
I'm following instructions for making a gantt chart from C- SharpImage.  The only part that doesn't work is the bar which is a label and the location of the Project name.  The Project name is a text input field.  The Project name is supposed to be at  the end of the bar (label). 
The X property of the bar (label) = Value((EndDays_1.Text) * 'Gantt Tasks_2'.Width/365)
The X property of the Project Name (Text Input) = Value(EndDays.Text) * 'Gantt Tasks_1'.Width/365
 
Any suggestions is appreciated
Sharon
 
Categories:
I have the same question (0)
  • Suggested answer
    Haque Profile Picture
    3,197 on at
    Hi @S S,
     
    Based on my understanding, tt depends how you calculate the X property for both controls. Your bar’s X property is:
    Value((EndDays_1.Text) * 'Gantt Tasks_2'.Width / 365)
    
    This positions the left edge of the bar based on the End day scaled to the width of the Gantt chart.
     
    Hence, to position the project name at the end of the bar, we need to position the text input relative to the bar’s right edge, not its left edge. The bar’s width is probably calculated as (EndDays_1.Text - StartDays_1.Text) * 'Gantt Tasks_2'.Width / 365.
    So, the right edge of the bar is:
    BarX + BarWidth

    Where:
    BarX = Value(StartDays_1.Text) * 'Gantt Tasks_2'.Width / 365
    BarWidth = (Value(EndDays_1.Text) - Value(StartDays_1.Text)) * 'Gantt Tasks_2'.Width / 365
     
     
    Therefore, set the Project Name text input’s X property to:
    (Value(StartDays_1.Text) + (Value(EndDays_1.Text) - Value(StartDays_1.Text))) * 'Gantt Tasks_2'.Width / 365
     
    More simplified one is:
    Value(EndDays_1.Text) * 'Gantt Tasks_2'.Width / 365
    
     
    If you want the project name to appear just after the bar, add a small offset (e.g., 5 pixels):
    (Value(EndDays_1.Text) * 'Gantt Tasks_2'.Width / 365) + 5
     

    I am sure some clues I tried to give. If these clues help to resolve the issue brought you by here, please don't forget to check the box Does this answer your question? At the same time, I am pretty sure you have liked the response!
     
     
     
  • Verified answer
    TechFreak Profile Picture
    149 on at

    Hi Sharon,

    You’re very close — the issue here is mainly around inconsistent references and positioning logic in your X property formulas.

    What’s causing the misalignment

    From your formulas:
     

    Value((EndDays_1.Text) * 'Gantt Tasks_2'.Width/365)
     
    vs
     
    Value(EndDays.Text) * 'Gantt Tasks_1'.Width/365
    There are two key problems:

    1. Different controls are being referenced


      • EndDays vs EndDays_1

      • 'Gantt Tasks_1' vs 'Gantt Tasks_2'


        This means your bar and your project name are being positioned using different coordinate systems, so they won’t align.


      •  

    2. The label (bar) and text input are not anchored to each other

      • You are calculating both positions independently

      • Instead, the project name should be positioned relative to the bar
     

    Recommended Fix

    ✔ Step 1: Use the same base calculation

    Make sure both use the same control references:
    Value(EndDays.Text) * 'Gantt Tasks_1'.Width / 365
     
     
    ✔ Step 2: Anchor the Project Name to the bar
     

    Instead of recalculating again, set the X property of the Project Name (Text Input) like this:

    BarLabel.X + BarLabel.Width + 5
     
    This ensures:

    • The project name always appears at the end of the bar

    • No dependency on recalculating dates again

    • Perfect alignment even if bar size changes

    •  

    Why this works

    Think of your bar as the “train” 🚆 and the project name as the “last coach” —

    instead of giving both separate GPS coordinates, you simply attach the coach to the train.

     

    Bonus Tips


    • Avoid using .Text where possible; prefer numeric values directly

    • Ensure EndDays is truly numeric (or wrap with Value() consistently)

    • If using galleries, confirm both controls are inside the same container/template
     

    Summary


    • Use consistent references (EndDays, same container width)

    • Don’t calculate positions separately

    • Position the project name relative to the bar
     
     

    If this resolves your issue, please mark the answer as accepted and give it a like. It helps others in the community and supports knowledge sharing. Thanks!

  • S S Profile Picture
    192 Season of Giving Solutions 2025 on at
    IT WORKED!  Thank you!
     
    I changed my Project x property = 
    (Value(EndDays_1.Text) * 'Gantt Tasks_2'.Width / 365) + 5
     
    Here's my tree which explains why I have an _1 and an _2  (my second try on the second gallery in screen1_1)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 875

#2
Valantis Profile Picture

Valantis 530

#3
11manish Profile Picture

11manish 432

Last 30 days Overall leaderboard