This is a migrated thread and some comments may be shown as answers.

GanttView Time Range Day Does not display properly

4 Answers 260 Views
GanttView
This is a migrated thread and some comments may be shown as answers.
Josh
Top achievements
Rank 1
Josh asked on 13 Jan 2017, 02:43 PM

I have a gantt view that I want to populate with data, but when i set it to the day range the the major timeline grid sizing seems to scale to the size of the container rather than to the secondary time line grid (see attached picture). The gantt view items are properly scaled to the major grid, but the secondary timeline markings are wrong. Is there a setting that i can use to make the major timeline grid marks stretch over all the available secondary timeline markings?

This is running on windows 10, telerik ui for winforms 2016 R3.

To replicate the issue create a new project with a gantview and use the following code in the load function.

        RadGanttView1.GanttViewElement.GraphicalViewElement.TimelineRange = Telerik.WinControls.UI.TimeRange.Day
        RadGanttView1.GanttViewElement.GraphicalViewElement.TimelineStart = Today
        RadGanttView1.GanttViewElement.GraphicalViewElement.TimelineEnd = Today.AddHours(24)
        Dim tasks As New DataTable("Tasks")
        tasks.Columns.Add("Id", GetType(Integer))
        tasks.Columns.Add("ParentId", GetType(Integer))
        tasks.Columns.Add("Title", GetType(String))
        tasks.Columns.Add("Start", GetType(DateTime))
        tasks.Columns.Add("End", GetType(DateTime))
        tasks.Columns.Add("Progress", GetType(Decimal))
        Dim links As New DataTable("Links")
        links.Columns.Add("StartId", GetType(Integer))
        links.Columns.Add("EndId", GetType(Integer))
        links.Columns.Add("LinkType", GetType(Integer))
        Dim data As New DataSet()
        data.Tables.Add(tasks)
        data.Tables.Add(links)
        tasks.Rows.Add(1, 0, "Summary task title", Today.AddHours(11), Today.AddHours(12), 30D)
        tasks.Rows.Add(2, 1, "First child task title", Today.AddHours(11), Today.AddHours(11.5), 10)
        tasks.Rows.Add(3, 1, "Second child task title", Today.AddHours(11.5), Today.AddHours(12), 20D)
        tasks.Rows.Add(4, 1, "Milestone", Today.AddHours(12), Today.AddHours(12), 0D)
        links.Rows.Add(2, 3, 1)
        links.Rows.Add(3, 4, 1)
        Me.RadGanttView1.GanttViewElement.TaskDataMember = "Tasks"
        Me.RadGanttView1.GanttViewElement.ChildMember = "Id"
        Me.RadGanttView1.GanttViewElement.ParentMember = "ParentId"
        Me.RadGanttView1.GanttViewElement.TitleMember = "Title"
        Me.RadGanttView1.GanttViewElement.StartMember = "Start"
        Me.RadGanttView1.GanttViewElement.EndMember = "End"
        Me.RadGanttView1.GanttViewElement.ProgressMember = "Progress"
        Me.RadGanttView1.GanttViewElement.LinkDataMember = "Links"
        Me.RadGanttView1.GanttViewElement.LinkStartMember = "StartId"
        Me.RadGanttView1.GanttViewElement.LinkEndMember = "EndId"
        Me.RadGanttView1.GanttViewElement.LinkTypeMember = "LinkType"
        Me.RadGanttView1.GanttViewElement.DataSource = data
        Me.RadGanttView1.Columns.Add("Start")
        Me.RadGanttView1.Columns.Add("End")

 

4 Answers, 1 is accepted

Sort by
0
Accepted
Hristo
Telerik team
answered on 16 Jan 2017, 01:49 PM
Hello Josh,

Thank you for writing.

The observed behavior is caused by insufficient space for fitting all of the hours. As you have observed the task elements appear correct compared to the parent header, the hours, however, cannot fit. 

In these scenarios, it is appropriate to use a small scale for the graphical view. The OnePixelTime property determines how much time a single pixel represents. You can try setting it this way: 
Me.RadGanttView1.GanttViewElement.GraphicalViewElement.OnePixelTime = New TimeSpan(0, 1, 0)

I am also attaching a screenshot showing the result on my end. In addition, please also check the following feature request. I have added a vote for it on your behalf. It also features a solution with a custom layout handling scenarios similar to yours.

I hope this helps. Please let me know if you need further assistance.

Regards,
Hristo
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Josh
Top achievements
Rank 1
answered on 16 Jan 2017, 02:13 PM
Thank you,
That fixes the issue that I was having.
0
ngoc thuong
Top achievements
Rank 1
answered on 22 Nov 2017, 02:24 AM

I have the same problem.

Here is my code:

DateTime start = Convert.ToDateTime(DateTime.Now.ToShortDateString() + " 06:00");
DateTime end = Convert.ToDateTime(DateTime.Now.ToShortDateString() + " 22:00");
//TimeSpan span = Convert.ToDateTime(DateTime.Now.ToShortDateString() + " 23:59:59").Subtract(Convert.ToDateTime(DateTime.Now.ToShortDateString() + " 00:00"));

TimeSpan span = new TimeSpan(0 ,1, 0);
this.gtKeHoachSX.GanttViewElement.GraphicalViewElement.OnePixelTime = span;

this.gtKeHoachSX.GanttViewElement.TextViewElement.AutoSize = false;
this.gtKeHoachSX.GanttViewElement.TextViewElement.Size = new Size(300, 418);
this.gtKeHoachSX.GanttViewElement.GraphicalViewElement.AutomaticTimelineTimeRange = false;
this.gtKeHoachSX.GanttViewElement.GraphicalViewElement.Location = new Point(0, 0);
this.gtKeHoachSX.GanttViewElement.GraphicalViewElement.AutoSize = false;
this.gtKeHoachSX.GanttViewElement.GraphicalViewElement.Size = new Size(1000,418);
this.gtKeHoachSX.GanttViewElement.GraphicalViewElement.TimelineRange = TimeRange.Day;
gtKeHoachSX.GanttViewElement.GraphicalViewElement.TimelineStart = start;
gtKeHoachSX.GanttViewElement.GraphicalViewElement.TimelineEnd = end;

 

I have tried but it working not correctly. Please help me.

 

0
Hristo
Telerik team
answered on 22 Nov 2017, 11:41 AM
Hi,

Thank you for writing.

Please make sure that you subscribe to the feedback item, mentioned in my previous request: https://feedback.telerik.com/Project/154/Feedback/Details/205136-add-radganttview-improve-layout-of-the-ganttviewtimelineitemelement-so-that-th. The item is scheduled for development and it should be implemented for the R1 2018 release. You can also test with a different span set to the OnePixelTime property and see if it would fit better your local setup.

In case your issue persists, please open a support ticket and send us your project so that we can test it on our end.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
GanttView
Asked by
Josh
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Josh
Top achievements
Rank 1
ngoc thuong
Top achievements
Rank 1
Share this question
or