I am really new to infragistics Gantt ChartI have a problem. I was making a Gantt Chart. I made a GanttSeries and in that GanttSeries I made different GanttItem and in each GanttItem I added different GanttTimeEntry which made my Gantt Chart ready. Now my problemWhen I click on a specific GanttTimeEntry I need to retrieve the Start Time and End Time.I know you can track the click event on OnChartDataClicked but the Primitive's will be blank or null. So I cannot get the data's of that specific GanttTimeEntry. Is there any other way to get this. Hope you understood my problem and will come with a helping hand.
Thanks in Advance
Hai,
I have solved the Half of it. Here is what I have done till now.
I started from the top ie making the GanttSeries global. Using GanttSeries you can find which Ganttitem was Clicked. Since the "Key" of the GantItem is unique it can be used to find which GanttItem. Something like below
GanttItem ganttItem = ganttSeries.Items.FromKey(e.ColumnLabel); e.ColumnLabel will give you the GanttItem "Key".
Once you have found the GanttItem it is really easy to find which GanttEntryTime. Something like below can be done
GanttTimeEntry time = ganttItem.Times[e.DataRow] i suppose e.DataRow will give you which GanttTimeEntry.
so this will give you which GanttTimeEntry was clicked and now from that I can get the StartTime and EndTime and what all datas I want.
But now my problem is that this "e.DataRow" is always 0. always giving me the first GanttTimeEntry inside the GanttItem. Even if I click on the 2nd GanttTimeEntry it will give me the 1st GanttTimeEntry. Hope you guys understood the problem. Somebody help me how to get the e.DataRow.
Thanks in advance
unfortunately this information (what time entry was clicked) is just not passed back from the client to the server. so there isn't a solution to this problem that i know of :(
you can submit a feature request here: http://devcenter.infragistics.com/protected/requestfeature.aspx
Thanks David for your reply but I have solved it in my own way.
As David has said the datas are not passed from the client side to the server side but you can track the event at the client side itself I mean u can use javascript for tracking the events. This is how I have solved this.
Add the below written tag inside the opening and closing of the "'igchart:UltraChart" tag
<ClientSideEvents ClientOnMouseClick="UltraChart1_ClientOnMouseClick" />
This will call the javascript function
function UltraChart1_ClientOnMouseClick(this_ref, row, column, value, row_label, column_label, evt_type, layer_id)
Here also if you look the "row" will be 0 but the "layer_id" will be different. At the server side "layer_id" will be giving only the layer_id but at client side "layer_id" will be "layer_id-0", "layer_id-1", "layer_id-2" and so on. This 0,1,2 is our row id. Now its simple use the split function to split the string and save it inside a hidden field like below.
var rowId = layer_id.toString().split('-');document.getElementById('hdnText').value = rowId[1]; // 'hdnText' is the id of a hidden field
Dont forget to add OnChartDataClicked="UltraChart1_ChartDataClicked" as a attribute to the <igchart:UltraChart>
On returning it will be entrying this function
protected void UltraChart1_ChartDataClicked(object sender, ChartDataEventArgs e)
inside this function as I said in my second post start from GanttSeries and find which GanttItem like below
GanttItem ganttItem = ganttSeries.Items[e.DataColumn];
then from this GanttItem find the GanttTimeEntry like below
GanttTimeEntry ganttTimeEntry = ganttItem.Times[int.Parse(hdnText.Value)]; // hdnText is the id of the hidden field
once you have found the ganttTimeEntry it will be really really simple to find the start date and end date like below or any other data
DateTime startDate = ganttTimeEntry.Start;
DateTime endDate = ganttTimeEntry.End;
Isnt this a great solution? This solution may not be correct way to do in software development but when there is no other way to satisfy our clients we have do anything and everything.
Thanks for this example, I needed to open a window based on a chart click and needed the column number . Most of the stuff I do can be done server side so I am not a big client guy. When I checked the documentation adding events to the chart, I didn't see anything that would indicate the arguments :
The documentation at http://help.infragistics.com/Help/NetAdvantage/ASPNET/2009.1/CLR3.5/html/Infragistics35.WebUI.UltraWebChart.v9.1~Infragistics.WebUI.UltraWebChart.UltraChart~ClientSideEvents.html
Doesn't show anything about the arguments. Strictly speaking it's slightly different than adding the events but these little tid-bits sprinkled into the documentation or a note saying : SEE ALSO - ... would also help.
By the way, to add the event, I did the following
In the load event for the page I added
Dim sb As StringBuilder = New StringBuilder
sb.Append("<script>")
sb.Append(
"function OnChartMouseClick(this_ref, row, column, value, row_label, column_label, evt_type, layer_id){alert(column);}")
"</script>")
Dim cstype As Type = Me.[GetType]()
ClientScript.RegisterClientScriptBlock(cstype,
"OnChartMouseClick"
, sb.ToString)
First I put this in a IF NOTPOSTBACK block but found it would work unless on ever postback so I the script outside the if block
Also added this to the load event for the chart - added lines for chart colors since this took forever to find too.
Import system.drawing
import system.text
'change the chart colors
.Maroon}
UltraChart1.ColorModel.CustomPalette = colors
UltraChart1.ClientSideEvents.ClientOnMouseClick =
the client-side event arguments are documented here: http://help.infragistics.com/NetAdvantage/ASPNET/2010.3/CLR4.0/?page=WebChart_Client_Side_Events_CSOM.html