Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
80
How do you get GanttChart Data???
posted

This is my first time using Infragistics.  I literally have only a couple of days experience yet have a tight timeline to get this resolved.

I have an existing piece of code that loads up a GanttChart.  The chart itself is a visual of how many detailed items we may hvae for a given year.  So, the gantt chart will ONLY be one row with many "columns"  What I fail to see

is how the ChartDataEventArgs has NO data.  Given I will have one "row" of data the ONLY data item that comes back is the "row" index the user clicked on which is always ZERO.  Basically the chart looks like a multi-colored bar where the color changes when we have new data.  I need to know which color was clicked on.  For example you will see two months of red, followed by 3 months of green, followed by 4 months of blue (the X axis has months of the year).  I need to know which of the 3 "columns" was clicked so I know what detailed data to show.  I wanted to find some way of adding data to the ChartDataEventArgs so I know what was clicked.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

UltraChart1.Series.Clear();

 

 

Stack<int

> approvedColors = UltraChart1.SetTimelineColors();

 

 

GanttSeries series = new GanttSeries

();

 

 

IEnumerable<DateTime> dateStrings = (from Rate r in

value

 

 

select

r.EffectiveDate).Distinct();

 

 

GanttItem product = new

GanttItem

{

Label =

 

Convert.ToString("Rates"

)

};

 

 

foreach (DateTime date in

dateStrings)

{

 

 

 

 

var rate = (from Rate r in value where  r.EffectiveDate == date select  r).FirstOrDefault();

 

 

 

 

GanttTimeEntry t1 = UltraChart1.CreateTimeEntry(Convert

.ToString(rate.ID), rate.EffectiveDate, rate.ExpirationDate,

 

 

Color

.FromArgb(approvedColors.Pop()), rate.ID);

 

 

product.Times.Add(t1);

 

 

 

 

 

}

 

series.Items.Add(product);

UltraChart1.Series.Add(series);

UltraChart1.SetDefaultXAxis(UltraChart1,

 

new DateTime((ddlBenefitRange.SelectedValue == string.Empty ? DateTime.Now.Year : Convert

.ToInt32(ddlBenefitRange.SelectedValue)), 01, 01));

Parents
No Data
Reply
  • 26458
    Suggested Answer
    Offline posted

    A GanttItem is considered to be a single entity even though it can create multiple shapes with the Times collection, so Row and Column for each TimeEntry in a single GanttItem will always be the same. For windows gantt chart we added a time entry index to the e.primitive.tags, but unfortunately this can't be done for the web chart. To do this with the web chart is tricky. Since e.Primitive will be null for the web chart, the only way that I can think of to get the value is by handling the clientside ClientOnMouseClick event to get the value parameter. It will contain the start date - end date string. You would have to pass it to the server, at which point it can be parsed and used to create start and end time. After that, you can loop through the Times collection of your GanttItem and based on the start and end dates determine the index of the current time entry. Sorry there isn't an easier way to do this

Children