Changeset 983
- Timestamp:
- 12/12/08 18:13:12 (16 years ago)
- Location:
- trunk/sources
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources
- Property svn:ignore
-
old new 1 1 *.suo 2 _ReSharper.HeuristicLab 3 HeuristicLab.resharper 4 HeuristicLab.resharper.user
-
- Property svn:ignore
-
trunk/sources/HeuristicLab.Visualization.Test/LineChartTests.cs
r980 r983 1 using System; 1 2 using System.Drawing; 2 3 using NUnit.Framework; … … 47 48 row3.AddValue(2); 48 49 50 Random rand = new Random(); 51 52 for (int i = 0; i < 1000; i++) { 53 row1.AddValue(rand.NextDouble()*10); 54 row2.AddValue(rand.NextDouble()*10); 55 row3.AddValue(rand.NextDouble()*10); 56 } 57 58 f.ShowDialog(); 59 } 60 61 [Test] 62 public void TestAxes() { 63 LineChartTestForm f = new LineChartTestForm(); 64 65 IDataRow row1 = new DataRow(); 66 67 row1.Color = Color.Red; 68 row1.Thickness = 3; 69 row1.Style = DrawingStyle.Solid; 70 71 f.Model.AddDataRow(row1); 72 73 row1.AddValue(10); 74 row1.AddValue(5); 75 row1.AddValue(7); 76 row1.AddValue(3); 77 row1.AddValue(10); 78 row1.AddValue(2); 79 49 80 f.ShowDialog(); 50 81 } -
trunk/sources/HeuristicLab.Visualization/HeuristicLab.Visualization.csproj
r874 r983 4 4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 5 5 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 6 <ProductVersion>9.0. 21022</ProductVersion>6 <ProductVersion>9.0.30729</ProductVersion> 7 7 <SchemaVersion>2.0</SchemaVersion> 8 8 <ProjectGuid>{E392A1E2-DC95-4E33-B82E-8ED690EDA1AB}</ProjectGuid> … … 106 106 <Compile Include="Transform.cs" /> 107 107 <Compile Include="WorldShape.cs" /> 108 <Compile Include="XAxis.cs" /> 108 109 </ItemGroup> 109 110 <ItemGroup> -
trunk/sources/HeuristicLab.Visualization/LineChart.cs
r981 r983 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Diagnostics;4 3 using System.Drawing; 5 4 using System.Windows.Forms; … … 14 13 private double maxDataValue; 15 14 15 private readonly WorldShape root; 16 private readonly XAxis xAxis; 17 16 18 /// <summary> 17 19 /// This constructor shouldn't be called. Only required for the designer. … … 32 34 //TODO: correct Rectangle to fit 33 35 RectangleD clientRectangle = new RectangleD(-1, -1, 1, 1); 34 canvasUI1.MainCanvas.WorldShape = new WorldShape(clientRectangle, clientRectangle); 36 37 root = new WorldShape(clientRectangle, clientRectangle); 38 39 xAxis = new XAxis(); 40 root.AddShape(xAxis); 41 42 canvasUI1.MainCanvas.WorldShape = root; 35 43 36 44 CreateMouseEventListeners(); 37 45 38 46 this.model = model; 39 Item = (IItem)model;47 Item = model; 40 48 maxDataRowCount = 0; 41 49 //The whole data rows are shown per default … … 84 92 maxDataRowCount-0.9, 85 93 maxDataValue + ((maxDataValue - minDataValue) * 0.05)); 86 canvasUI1.MainCanvas.WorldShape.ClippingArea = newClippingArea;94 root.ClippingArea = newClippingArea; 87 95 } 88 96 … … 92 100 List<LineShape> lineShapes = new List<LineShape>(); 93 101 if (row.Count > 0) { 94 maxDataValue = Ma x(row[0], this.maxDataValue);95 minDataValue = M in(row[0], minDataValue);102 maxDataValue = Math.Max(row[0], this.maxDataValue); 103 minDataValue = Math.Min(row[0], minDataValue); 96 104 } 97 105 for (int i = 1; i < row.Count; i++) { … … 99 107 lineShapes.Add(lineShape); 100 108 // TODO each DataRow needs its own WorldShape so Y Axes can be zoomed independently. 101 canvasUI1.MainCanvas.WorldShape.AddShape(lineShape);102 maxDataValue = Ma x(row[i], maxDataValue);103 minDataValue = M in(row[i], minDataValue);109 root.AddShape(lineShape); 110 maxDataValue = Math.Max(row[i], maxDataValue); 111 minDataValue = Math.Min(row[i], minDataValue); 104 112 } 105 113 … … 109 117 } 110 118 111 private double Min(double d, double value) {112 return d < value ? d : value;113 }114 115 private double Max(double d, double value) {116 return d>value ? d : value;117 }118 119 119 private void OnDataRowRemoved(IDataRow row) { 120 120 row.ValueChanged -= OnRowValueChanged; … … 127 127 private void OnRowValueChanged(IDataRow row, double value, int index, Action action) { 128 128 List<LineShape> lineShapes = rowToLineShapes[row]; 129 maxDataValue = Ma x(value, maxDataValue);130 minDataValue = M in(value, minDataValue);129 maxDataValue = Math.Max(value, maxDataValue); 130 minDataValue = Math.Min(value, minDataValue); 131 131 132 132 if (index > lineShapes.Count + 1) { … … 206 206 canvasUI1.MouseEventListener = panListener; 207 207 208 startClippingArea = canvasUI1.MainCanvas.WorldShape.ClippingArea;208 startClippingArea = root.ClippingArea; 209 209 } 210 210 … … 228 228 newClippingArea.Y2 = startClippingArea.Y2 - yDiff; 229 229 230 canvasUI1.MainCanvas.WorldShape.ClippingArea = newClippingArea;230 root.ClippingArea = newClippingArea; 231 231 panListener.StartPoint = startPoint; 232 232
Note: See TracChangeset
for help on using the changeset viewer.