- Timestamp:
- 10/21/10 17:35:49 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Visualization.ChartControlsExtensions/3.3/EnhancedChart.cs
r4637 r4638 84 84 private Point PixelStartPosition; 85 85 private PointF ChartStartPosition; 86 private SizeF Pixel2ChartScale;87 86 88 87 public PanningSupport(Point pixelStartPos, ChartArea chartArea, Size size) { … … 92 91 (float)chartArea.AxisX.ScaleView.Position, 93 92 (float)chartArea.AxisY.ScaleView.Position); 94 Pixel2ChartScale = new SizeF(95 (float)chartArea.AxisX.ScaleView.Size /96 (size.Width * chartArea.Position.Width * chartArea.InnerPlotPosition.Width / 100 / 100),97 (float)chartArea.AxisY.ScaleView.Size /98 (size.Height * chartArea.Position.Height * chartArea.InnerPlotPosition.Height / 100 / 100));99 93 } 100 94 101 public double ChartX(double pixelX) { 102 return ChartStartPosition.X - (pixelX - PixelStartPosition.X) * Pixel2ChartScale.Width; 95 public double ChartX(double pixelX, int width) { 96 return ChartStartPosition.X - (pixelX - PixelStartPosition.X) * 97 (ChartArea.AxisX.ScaleView.ViewMaximum - ChartArea.AxisX.ScaleView.ViewMinimum) / 98 (width * ChartArea.Position.Width * ChartArea.InnerPlotPosition.Width / 100 / 100); 103 99 } 104 public double ChartY(double pixelY) { 105 return ChartStartPosition.Y + (pixelY - PixelStartPosition.Y) * Pixel2ChartScale.Height; 100 public double ChartY(double pixelY, int height) { 101 return ChartStartPosition.Y + (pixelY - PixelStartPosition.Y) * 102 (ChartArea.AxisY.ScaleView.ViewMaximum - ChartArea.AxisY.ScaleView.ViewMinimum) / 103 (height * ChartArea.Position.Height * ChartArea.InnerPlotPosition.Height / 100 / 100); 106 104 } 107 105 } … … 126 124 protected override void OnMouseMove(MouseEventArgs e) { 127 125 if (panning != null) { 128 double x = panning.ChartX(e.Location.X );129 double y = panning.ChartY(e.Location.Y );126 double x = panning.ChartX(e.Location.X, Width); 127 double y = panning.ChartY(e.Location.Y, Height); 130 128 if (panning.ChartArea.CursorX.Interval > 0) { 131 129 x = Math.Round(x * panning.ChartArea.CursorX.Interval) / panning.ChartArea.CursorX.Interval;
Note: See TracChangeset
for help on using the changeset viewer.