Changeset 12458


Ignore:
Timestamp:
06/16/15 14:36:10 (4 years ago)
Author:
ascheibe
Message:

#2354 show label when no data is displayed and don't show the legend

Location:
trunk/sources/HeuristicLab.Analysis.Views/3.3
Files:
2 edited

Legend:

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

    r12143 r12458  
    4848    private void InitializeComponent() {
    4949      this.components = new System.ComponentModel.Container();
    50       System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
    51       System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
    52       System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
     50      System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
     51      System.Windows.Forms.DataVisualization.Charting.Legend legend2 = new System.Windows.Forms.DataVisualization.Charting.Legend();
     52      System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series();
    5353      this.chart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart();
    5454      this.binsNumericUpDown = new System.Windows.Forms.NumericUpDown();
     
    5757      this.label2 = new System.Windows.Forms.Label();
    5858      this.bandwidthNumericUpDown = new System.Windows.Forms.NumericUpDown();
     59      this.noDataLabel = new System.Windows.Forms.Label();
    5960      ((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit();
    6061      ((System.ComponentModel.ISupportInitialize)(this.binsNumericUpDown)).BeginInit();
     
    6768            | System.Windows.Forms.AnchorStyles.Left)
    6869            | System.Windows.Forms.AnchorStyles.Right)));
    69       chartArea1.Name = "ChartArea1";
    70       this.chart.ChartAreas.Add(chartArea1);
    71       legend1.Alignment = System.Drawing.StringAlignment.Center;
    72       legend1.Docking = System.Windows.Forms.DataVisualization.Charting.Docking.Top;
    73       legend1.Name = "Default";
    74       this.chart.Legends.Add(legend1);
     70      chartArea2.Name = "ChartArea1";
     71      this.chart.ChartAreas.Add(chartArea2);
     72      legend2.Alignment = System.Drawing.StringAlignment.Center;
     73      legend2.Docking = System.Windows.Forms.DataVisualization.Charting.Docking.Top;
     74      legend2.Name = "Default";
     75      this.chart.Legends.Add(legend2);
    7576      this.chart.Location = new System.Drawing.Point(0, 27);
    7677      this.chart.Name = "chart";
    77       series1.ChartArea = "ChartArea1";
    78       series1.Legend = "Default";
    79       series1.Name = "Series1";
    80       this.chart.Series.Add(series1);
     78      series2.ChartArea = "ChartArea1";
     79      series2.Legend = "Default";
     80      series2.Name = "Series1";
     81      this.chart.Series.Add(series2);
    8182      this.chart.Size = new System.Drawing.Size(465, 336);
    8283      this.chart.TabIndex = 0;
     
    159160      this.bandwidthNumericUpDown.ValueChanged += new System.EventHandler(this.bandwidthNumericUpDown_ValueChanged);
    160161      //
     162      // noDataLabel
     163      //
     164      this.noDataLabel.Anchor = System.Windows.Forms.AnchorStyles.None;
     165      this.noDataLabel.AutoSize = true;
     166      this.noDataLabel.Location = new System.Drawing.Point(163, 175);
     167      this.noDataLabel.Name = "noDataLabel";
     168      this.noDataLabel.Size = new System.Drawing.Size(139, 13);
     169      this.noDataLabel.TabIndex = 22;
     170      this.noDataLabel.Text = "No data could be displayed.";
     171      //
    161172      // HistogramControl
    162173      //
    163174      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
     175      this.Controls.Add(this.noDataLabel);
    164176      this.Controls.Add(this.label2);
    165177      this.Controls.Add(this.bandwidthNumericUpDown);
     
    186198    private System.Windows.Forms.Label label2;
    187199    private System.Windows.Forms.NumericUpDown bandwidthNumericUpDown;
     200    private System.Windows.Forms.Label noDataLabel;
    188201  }
    189202}
  • trunk/sources/HeuristicLab.Analysis.Views/3.3/HistogramControl.cs

    r12173 r12458  
    139139        if (!point.Value.Any()) continue;
    140140
    141         Series histogramSeries = new Series(point.Key);
    142         chart.Series.Add(histogramSeries);
    143141        double minValue = point.Value.Min();
    144142        double maxValue = point.Value.Max();
    145143        double intervalWidth = (maxValue - minValue) / bins;
    146144        if (intervalWidth <= 0) continue;
     145
     146        Series histogramSeries = new Series(point.Key);
     147        chart.Series.Add(histogramSeries);
    147148
    148149        if (!exactCheckBox.Checked) {
     
    172173      }
    173174
     175      if (chart.Series.Any()) {
     176        noDataLabel.Visible = false;
     177      } else {
     178        noDataLabel.Visible = true;
     179      }
     180
    174181      ChartArea chartArea = chart.ChartAreas[0];
    175182      // don't show grid lines for second y-axis
Note: See TracChangeset for help on using the changeset viewer.