Greetings!
I have a grid (well that grid's datasource actually) backing a UltraChart that's a Gantt type. There are particular rows in the grid that I want excluded from the from that Gantt chart based on the value in cell of in the row. How can I do this? Setting the column indices for the gantt chart data isn't good enough, e.g.
chartGantt.GanttChart.Columns.SeriesLabelsColumnIndex = -1
chartGantt.GanttChart.Columns.ItemLabelsColumnIndex = grid.DisplayLayout.Bands(0).Columns("Name").Index
chartGantt.GanttChart.Columns.StartTimeColumnIndex = grid.DisplayLayout.Bands(0).Columns("Start").Index
chartGantt.GanttChart.Columns.EndTimeColumnIndex = grid.DisplayLayout.Bands(0).Columns("End").Index
chartGantt.GanttChart.Columns.IDColumnIndex = grid.DisplayLayout.Bands(0).Columns("ID").Index
chartGantt.GanttChart.Columns.LinkToColumnIndex = -1
chartGantt.GanttChart.Columns.PercentCompleteColumnIndex = grid.DisplayLayout.Bands(0).Columns("completepercent").Index
chartGantt.GanttChart.Columns.OwnerColumnIndex = -1
This won't do because I can't filter out rows. I tried copying the desired data from the grid/datasource to a GanttDataSource bound to the chart but that made the chart static until the data in the GanttDataSource is updated. We need the chart to be updated when users edit the values in the grid. I tried setting the Empty property to true on the GanttItem objects added to the GanttSeries but that didn't work either.
The GanttDataSource is not visible in the VS Designer toolbix otherwise I might try to drop it on the form and attach it to the grid. However, the grid has additional information that is not storeable in the GanttDataSource.
Any suggestions?
Hello Craig,
csmith0651 said:The ideal approach, I think, is to have a Boolean enable property on the GanttItem.
Regards
Hi!
That's a very interesting approach but I do want the data visible in the grid so applying a filter to alter the gantt chart's appearance is not enough. The ideal approach, I think, is to have a Boolean enable property on the GanttItem. To avoid the copying to the GanttDataSource from the grid's datasource perhaps we should be able to create a GanttDataSource object from within the Visual Studio toolbox and attach it to a grid.
Alternatively to avoid changing APIs or adding a significant number of features, perhaps a runtime way of setting a filter on the GanttChart to applies to it's datasource, e.g. ignore rows containing this data would be appropriate. Perhaps a lambda function that returns a Boolean and is applied to each row item be it a GanttItem or an UltraDataRow.
Craig
Thanks for provided information. Regarding your questions, please note that our chart represent the data from the DataSet and If you are using the same DataSet like a DataSource to your UltraGrid, all filtering operation in the UltraGrid are not reflect in the DataSet, so does not reflect in the Chart. The mentioned behavior could be achieved, if you are filtering the data into your DataSet. For example you could handle UltraGrid`s "AfterRowFilterChanged" event and on a based of the used filter condition, you could filtering your DataSet, respectively your Chart.
csmith0651 said: I want the row to remain visible in the grid, just not be displayed in the Gantt chart..
With the mentioned approach above all, you could not be able to remain visible that rows in the Grid., so you should used a copy of your DataSet, but this will make this task more complicated. Other possible approach is your approach - with GanttDataSource.
Let me know if you have any questions.
Your example code and video are very generous. Thank you for putting it together. However I don't believe you understood my question because your example does not address the key functionality I desire.
I'm going beyond basic functionality of the Gantt chart, as I said in my original post. I'm looking for a way to filter out rows based on contents in the grid acting as the DataSource for the chart. In your example, how would you filter out a row from the Gantt chart if it had "Craig" as the owner? I want the row to remain visible in the grid, just not be displayed in the Gantt chart..
For the time being I have created a separate GanttDataSource object, bound to the chart, that I copy all the value from the grid filtering out the unwanted rows. This, as I also mentioned previously, makes the chart static when I edit the grid. To fix that, in an AfterCellUpdate handler bound to the grid, I copy all the values from the grid to the GanttDataSource (yes I could refine it to copy the specific cell but the data is small and the logic is prone to errors so I went with KISS). This is ugly in my opinion. What I really want is to set an enable/visible property to false in the GanttItem object.
If you have a better solution, I would love to hear it. Thanks!
Hi
I try to reproduce your scenario in a small sample. Could you pleale take a look at the attached sample, video file and screenshot for more details and let me know if you have any questions
Also maybe will be interesting for you to take a look at our UltraGanttView controls which has similar behavior. More information you could find in our online documentation:
http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.2/CLR2.0/html/WinGanttView.html
http://help.infragistics.com/Help/NetAdvantage/WinForms/2011.2/CLR2.0/html/WinGanttView_Custom_Columns.html
Video: