Changeset 8107
- Timestamp:
- 06/25/12 17:02:06 (12 years ago)
- Location:
- trunk/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Clients.Hive.Views/3.3/StateLog/StateLogGanttChartListView.cs
r7728 r8107 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using System.Drawing; 24 25 using System.Linq; 26 using System.Windows.Forms; 27 using System.Windows.Forms.DataVisualization.Charting; 25 28 using HeuristicLab.Core.Views; 26 29 using HeuristicLab.MainForm; … … 31 34 [Content(typeof(StateLogListList), true)] 32 35 public sealed partial class StateLogGanttChartListView : ItemView { 36 private IList<LegendItem> invisibleLegendItems; 37 33 38 public new StateLogListList Content { 34 39 get { return (StateLogListList)base.Content; } … … 38 43 public StateLogGanttChartListView() { 39 44 InitializeComponent(); 45 invisibleLegendItems = new List<LegendItem>(); 40 46 } 41 47 42 48 protected override void DeregisterContentEvents() { 43 49 // Deregister your event handlers here 50 ganttChart.chart.MouseMove -= new System.Windows.Forms.MouseEventHandler(chart_MouseDown); 51 ganttChart.chart.MouseDown -= new System.Windows.Forms.MouseEventHandler(chart_MouseDown); 52 ganttChart.chart.CustomizeLegend -= new EventHandler<CustomizeLegendEventArgs>(chart_CustomizeLegend); 44 53 base.DeregisterContentEvents(); 45 54 } … … 48 57 base.RegisterContentEvents(); 49 58 // Register your event handlers here 59 ganttChart.chart.MouseMove += new System.Windows.Forms.MouseEventHandler(chart_MouseMove); 60 ganttChart.chart.MouseDown += new System.Windows.Forms.MouseEventHandler(chart_MouseDown); 61 ganttChart.chart.CustomizeLegend += new EventHandler<CustomizeLegendEventArgs>(chart_CustomizeLegend); 50 62 } 51 63 … … 75 87 for (int i = Content.Count - 1; i >= 0; i--) { 76 88 for (int j = 0; j < Content[i].Count - 1; j++) { 77 if (Content[i][j].State != TaskState.Offline )89 if (Content[i][j].State != TaskState.Offline && invisibleLegendItems.All(x => x.Name != Content[i][j].State.ToString())) 78 90 AddData(ganttChart, i.ToString(), Content[i][j], Content[i][j + 1], upperLimit); 79 91 } 80 if (Content[i].Count > 0 ) {92 if (Content[i].Count > 0 && invisibleLegendItems.All(x => x.Name != Content[i][Content[i].Count - 1].State.ToString())) { 81 93 AddData(ganttChart, i.ToString(), Content[i][Content[i].Count - 1], null, upperLimit); 82 94 } … … 113 125 base.SetEnabledStateOfControls(); 114 126 } 127 128 #region Events 129 void chart_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { 130 HitTestResult result = ganttChart.chart.HitTest(e.X, e.Y); 131 if (result.ChartElementType == ChartElementType.LegendItem) 132 Cursor = Cursors.Hand; 133 else 134 Cursor = Cursors.Default; 135 } 136 137 private void chart_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { 138 HitTestResult result = ganttChart.chart.HitTest(e.X, e.Y); 139 if (result.ChartElementType == ChartElementType.LegendItem) 140 ToggleLegendItemVisibility(result.Object as LegendItem); 141 ganttChart.Reset(); 142 OnContentChanged(); 143 } 144 145 private void chart_CustomizeLegend(object sender, CustomizeLegendEventArgs e) { 146 foreach (var item in e.LegendItems) 147 foreach (var cell in item.Cells) 148 cell.ForeColor = invisibleLegendItems.Any(x => x.Name == item.Name) ? Color.Gray : Color.Black; 149 } 150 #endregion 151 152 #region Helpers 153 private void ToggleLegendItemVisibility(LegendItem legendItem) { 154 var item = invisibleLegendItems.FirstOrDefault(x => x.Name == legendItem.Name); 155 if (item != null) invisibleLegendItems.Remove(item); 156 else invisibleLegendItems.Add(legendItem); 157 } 158 #endregion 115 159 } 116 160 } -
trunk/sources/HeuristicLab.Visualization.ChartControlsExtensions/3.3/GanttChart.Designer.cs
r7967 r8107 36 36 | System.Windows.Forms.AnchorStyles.Left) 37 37 | System.Windows.Forms.AnchorStyles.Right))); 38 chartArea1.AxisX.ScaleView.SmallScrollMinSizeType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Milliseconds; 39 chartArea1.AxisY.ScaleView.SmallScrollMinSizeType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Milliseconds; 40 chartArea1.CursorX.IntervalType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Milliseconds; 41 chartArea1.CursorY.IntervalType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Milliseconds; 38 42 chartArea1.Name = "ChartArea1"; 39 43 this.chart.ChartAreas.Add(chartArea1); -
trunk/sources/HeuristicLab.Visualization.ChartControlsExtensions/3.3/GanttChart.cs
r7410 r8107 35 35 public GanttChart() { 36 36 InitializeComponent(); 37 chart.CustomizeAllChartAreas(); 37 38 } 38 39
Note: See TracChangeset
for help on using the changeset viewer.