Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14737


Ignore:
Timestamp:
03/09/17 09:35:42 (7 years ago)
Author:
abeham
Message:

#2744:

  • GanttData: Derived from NamedItem instead of Item and implement appropriate constructors
  • GanttRow: Implemented appropriate constructors and choosing a default name
  • GanttDataView: Added additional event handler for tracking category colors dictionary
  • GanttDataView: Set title property of GanttChart
  • GanttChart: Added a title (which is hidden by default)
Location:
trunk/sources
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Analysis.Views/3.3/GanttDataView.cs

    r14734 r14737  
    5050      Content.Rows.ItemsReplaced += GanttRowsOnChanged;
    5151      Content.Rows.CollectionReset += GanttRowsOnChanged;
     52      Content.CategoryColors.ItemsAdded += GanttCategoryColorsOnChanged;
     53      Content.CategoryColors.ItemsRemoved += GanttCategoryColorsOnChanged;
     54      Content.CategoryColors.ItemsReplaced += GanttCategoryColorsOnChanged;
     55      Content.CategoryColors.CollectionReset += GanttCategoryColorsOnChanged;
    5256      foreach (var row in Content.Rows)
    5357        RegisterGanttRowEvents(row);
     
    7377      Content.Rows.ItemsReplaced -= GanttRowsOnChanged;
    7478      Content.Rows.CollectionReset -= GanttRowsOnChanged;
     79      Content.CategoryColors.ItemsAdded -= GanttCategoryColorsOnChanged;
     80      Content.CategoryColors.ItemsRemoved -= GanttCategoryColorsOnChanged;
     81      Content.CategoryColors.ItemsReplaced -= GanttCategoryColorsOnChanged;
     82      Content.CategoryColors.CollectionReset -= GanttCategoryColorsOnChanged;
    7583      foreach (var row in Content.Rows)
    7684        DeregisterGanttRowEvents(row);
     
    121129     
    122130      ganttChart.Hide();
     131      ganttChart.Title = string.IsNullOrWhiteSpace(Content.Name) ? null : Content.Name;
    123132      foreach (var row in Content.Rows) {
    124133        foreach (var item in row.Items) {
     
    138147      UpdateVisualization();
    139148    }
    140 
    141149    private void GanttRowsOnRemoved(object sender, CollectionItemsChangedEventArgs<GanttRow> e) {
    142150      foreach (var row in e.Items)
    143151        DeregisterGanttRowEvents(row);
    144152
     153      UpdateVisualization();
     154    }
     155    private void GanttCategoryColorsOnChanged(object sender, EventArgs e) {
    145156      UpdateVisualization();
    146157    }
  • trunk/sources/HeuristicLab.Analysis/3.3/DataVisualization/GanttData.cs

    r14734 r14737  
    3434  [Item("Gantt Data", "Data of a Gantt visualization")]
    3535  [StorableClass]
    36   public class GanttData : Item {
     36  public class GanttData : NamedItem {
    3737
    3838    [Storable]
     
    5151      categoryColors = new ObservableDictionary<string, Color>(original.categoryColors);
    5252    }
    53     public GanttData() {
     53    public GanttData() : this("Gantt Data", "Data of a Gantt visualization") { }
     54    public GanttData(string name) : this(name, string.Empty) { }
     55    public GanttData(string name, string description) : base(name, description) {
    5456      rows = new NamedItemCollection<GanttRow>();
    5557      categoryColors = new ObservableDictionary<string, Color>();
    5658    }
    57     public GanttData(IEnumerable<GanttRow> rows) {
     59    public GanttData(IEnumerable<GanttRow> rows) : this("Gantt Data", rows) { }
     60    public GanttData(string name, IEnumerable<GanttRow> rows) : this(name, string.Empty, rows) { }
     61    public GanttData(string name, string description, IEnumerable<GanttRow> rows) : base(name, description) {
    5862      this.rows = new NamedItemCollection<GanttRow>(rows);
    5963      categoryColors = new ObservableDictionary<string, Color>();
     
    7882      items = cloner.Clone(original.items);
    7983    }
    80     public GanttRow() {
     84    public GanttRow() : this("Gantt Row", "Row of a Gantt chart") { }
     85    public GanttRow(string name) : this(name, string.Empty) { }
     86    public GanttRow(string name, string description) : base(name, description) {
    8187      items = new ItemList<GanttItem>();
    8288    }
    83     public GanttRow(IEnumerable<GanttItem> items) {
     89    public GanttRow(IEnumerable<GanttItem> items) : this("Gantt Row", items) { }
     90    public GanttRow(string name, IEnumerable<GanttItem> items) : this(name, string.Empty, items) { }
     91    public GanttRow(string name, string description, IEnumerable<GanttItem> items) : base(name, description) {
    8492      this.items = new ItemList<GanttItem>(items);
    8593    }
  • trunk/sources/HeuristicLab.Visualization.ChartControlsExtensions/3.3/GanttChart.Designer.cs

    r14185 r14737  
    4545    /// </summary>
    4646    private void InitializeComponent() {
     47      this.components = new System.ComponentModel.Container();
    4748      System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
    4849      System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
    4950      System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
     51      System.Windows.Forms.DataVisualization.Charting.Title title1 = new System.Windows.Forms.DataVisualization.Charting.Title();
    5052      this.chart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart();
    5153      ((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit();
     
    5456      // chart
    5557      //
    56       this.chart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    57                   | System.Windows.Forms.AnchorStyles.Left)
    58                   | System.Windows.Forms.AnchorStyles.Right)));
     58      this.chart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     59            | System.Windows.Forms.AnchorStyles.Left)
     60            | System.Windows.Forms.AnchorStyles.Right)));
    5961      chartArea1.AxisX.ScaleView.SmallScrollMinSizeType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Milliseconds;
    6062      chartArea1.AxisY.ScaleView.SmallScrollMinSizeType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Milliseconds;
     
    7981      this.chart.TabIndex = 0;
    8082      this.chart.Text = "chart";
     83      title1.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     84      title1.Name = "Gantt Title";
     85      title1.Text = "Gantt Title";
     86      title1.Visible = false;
     87      this.chart.Titles.Add(title1);
    8188      //
    8289      // GanttChart
    8390      //
    84       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    8591      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    8692      this.Controls.Add(this.chart);
  • trunk/sources/HeuristicLab.Visualization.ChartControlsExtensions/3.3/GanttChart.cs

    r14185 r14737  
    3232    private IDictionary<string, Color> categories = new Dictionary<string, Color>();
    3333    private IDictionary<string, int> rowNames = new Dictionary<string, int>();
     34
     35    public string Title {
     36      get { return chart.Titles[0].Text; }
     37      set {
     38        chart.Titles[0].Text = value ?? string.Empty;
     39        chart.Titles[0].Visible = value != null;
     40      }
     41    }
    3442
    3543    public GanttChart() {
Note: See TracChangeset for help on using the changeset viewer.