Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4636


Ignore:
Timestamp:
10/21/10 14:45:44 (14 years ago)
Author:
epitzer
Message:

More improvements to EnhancedChart (#1237)

  • Fixed panning (now snaps to selected cursor interval)
  • Changed chart type in DataTableView to EnhancedChart
  • Added static method CustomizeChartArea()
  • Changed CustomizeChartAreas() to CustomizeAllChartAreas()
  • Disabled cursor cross hair
  • Smaller title font
Location:
trunk/sources
Files:
4 edited

Legend:

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

    r4142 r4636  
    4949      System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
    5050      System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
    51       this.chart = new System.Windows.Forms.DataVisualization.Charting.Chart();
     51      this.chart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart();
    5252      this.contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
    5353      this.exportChartToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     
    7070      // chart
    7171      //
    72       this.chart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    73                   | System.Windows.Forms.AnchorStyles.Left)
    74                   | System.Windows.Forms.AnchorStyles.Right)));
     72      this.chart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
     73            | System.Windows.Forms.AnchorStyles.Left)
     74            | System.Windows.Forms.AnchorStyles.Right)));
    7575      this.chart.BorderlineColor = System.Drawing.Color.Black;
    7676      this.chart.BorderlineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Solid;
     
    8585      legend1.Name = "Legend1";
    8686      this.chart.Legends.Add(legend1);
     87      this.chart.EnableDoubleClickResetsZoom = true;
     88      this.chart.EnableMiddleClickPanning = true;
    8789      this.chart.Location = new System.Drawing.Point(0, 52);
    8890      this.chart.Name = "chart";
     
    139141    #endregion
    140142
    141     private System.Windows.Forms.DataVisualization.Charting.Chart chart;
     143    private HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart chart;
    142144    private System.Windows.Forms.ContextMenuStrip contextMenuStrip;
    143145    private System.Windows.Forms.ToolStripMenuItem exportChartToolStripMenuItem;
  • trunk/sources/HeuristicLab.Analysis.Views/3.3/DataTableView.cs

    r4623 r4636  
    5656      valuesRowsTable = new Dictionary<IObservableList<double>, DataRow>();
    5757      invisibleSeries = new List<Series>();
     58      chart.CustomizeAllChartAreas();
     59      chart.ChartAreas[0].CursorX.Interval = 1;
    5860    }
    5961
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.cs

    r4635 r4636  
    6161      colorButton.Image = this.GenerateImage(16, 16, this.colorDialog.Color);
    6262      isSelecting = false;
    63 
    64       chart.CustomizeChartAreas();
    65       chart.EnableMiddleClickPanning = false;
    66       chart.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;
    67       chart.ChartAreas[0].CursorY.IsUserSelectionEnabled = true;
     63      chart.CustomizeAllChartAreas();
    6864      chart.ChartAreas[0].CursorX.Interval = 1;
    6965      chart.ChartAreas[0].CursorY.Interval = 1;
  • trunk/sources/HeuristicLab.Visualization.ChartControlsExtensions/3.3/EnhancedChart.cs

    r4635 r4636  
    2020#endregion
    2121
     22using System;
    2223using System.ComponentModel;
    2324using System.Drawing;
     
    3132      EnableDoubleClickResetsZoom = true;
    3233      EnableMiddleClickPanning = true;
    33       CustomizeChartAreas();
     34      CustomizeAllChartAreas();
    3435    }
    3536
     
    3940    public bool EnableMiddleClickPanning { get; set; }
    4041
    41     public void CustomizeChartAreas() {
     42    public static void CustomizeChartArea(ChartArea chartArea) {
     43      foreach (Axis axis in chartArea.Axes) {
     44        axis.MajorGrid.LineColor = SystemColors.GradientInactiveCaption;
     45        axis.MajorTickMark.TickMarkStyle = TickMarkStyle.AcrossAxis;
     46        axis.ScrollBar.BackColor = Color.Transparent;
     47        axis.ScrollBar.LineColor = Color.Transparent;
     48        axis.ScrollBar.ButtonColor = SystemColors.GradientInactiveCaption;
     49        axis.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll;
     50        axis.ScrollBar.Size = 12;
     51        axis.TitleFont = new Font(axis.TitleFont.FontFamily, 10);
     52      }
     53      chartArea.CursorX.Interval = 0;
     54      chartArea.CursorY.Interval = 0;
     55      chartArea.CursorX.IsUserSelectionEnabled = true;
     56      chartArea.CursorY.IsUserSelectionEnabled = true;
     57      chartArea.CursorX.IsUserEnabled = false;
     58      chartArea.CursorY.IsUserEnabled = false;
     59      chartArea.CursorX.SelectionColor = SystemColors.GradientActiveCaption;
     60      chartArea.CursorY.SelectionColor = SystemColors.GradientActiveCaption;
     61    }
     62
     63    public void CustomizeAllChartAreas() {
    4264      foreach (ChartArea chartArea in ChartAreas) {
    43         foreach (Axis axis in chartArea.Axes) {
    44           axis.MajorGrid.LineColor = SystemColors.GradientInactiveCaption;
    45           axis.MajorTickMark.TickMarkStyle = TickMarkStyle.AcrossAxis;
    46           axis.ScrollBar.BackColor = Color.Transparent;
    47           axis.ScrollBar.LineColor = Color.Transparent;
    48           axis.ScrollBar.ButtonColor = SystemColors.GradientInactiveCaption;
    49           axis.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll;
    50           axis.ScrollBar.Size = 12;
    51           axis.TitleFont = new Font(axis.TitleFont.FontFamily, 12);
    52         }
    53 
    54         chartArea.CursorX.Interval = 0;
    55         chartArea.CursorY.Interval = 0;
    56         chartArea.CursorX.IsUserSelectionEnabled = true;
    57         chartArea.CursorY.IsUserSelectionEnabled = true;
    58         chartArea.CursorX.SelectionColor = SystemColors.GradientActiveCaption;
    59         chartArea.CursorY.SelectionColor = SystemColors.GradientActiveCaption;
     65        CustomizeChartArea(chartArea);
    6066      }
    6167    }
     
    122128    protected override void OnMouseMove(MouseEventArgs e) {
    123129      if (panning != null) {
    124         panning.ChartArea.AxisX.ScaleView.Scroll(panning.ChartX(e.Location.X));
    125         panning.ChartArea.AxisY.ScaleView.Scroll(panning.ChartY(e.Location.Y));
     130        double x = panning.ChartX(e.Location.X);
     131        double y = panning.ChartY(e.Location.Y);
     132        if (panning.ChartArea.CursorX.Interval > 0) {
     133          x = Math.Round(x * panning.ChartArea.CursorX.Interval) / panning.ChartArea.CursorX.Interval;
     134          y = Math.Round(y * panning.ChartArea.CursorY.Interval) / panning.ChartArea.CursorY.Interval;
     135        }
     136        panning.ChartArea.AxisX.ScaleView.Scroll(x);
     137        panning.ChartArea.AxisY.ScaleView.Scroll(y);
    126138      }
    127139      base.OnMouseMove(e);
Note: See TracChangeset for help on using the changeset viewer.