Changeset 1880
- Timestamp:
- 05/23/09 10:19:25 (16 years ago)
- Location:
- trunk/sources
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Visualization.Test/3.2/LineChartTests.cs
r1876 r1880 82 82 YAxisDescriptor yaxis2 = new YAxisDescriptor(); 83 83 84 model.XAxis Label = "X Axis";85 model. ShowXAxisLabel = true;84 model.XAxis.XAxisLabel = "X Axis"; 85 model.XAxis.ShowXAxisLabel = true; 86 86 87 87 yaxis1.Label = "Y-Axis 1"; … … 139 139 model.AddDataRow(row1); 140 140 141 model. ShowXAxisGrid = false;141 model.XAxis.ShowXAxisGrid = false; 142 142 143 143 Random rand = new Random(42); -
trunk/sources/HeuristicLab.Visualization/3.2/CanvasUI.cs
r1530 r1880 18 18 } 19 19 20 public event PaintEventHandler BeforePaint; 21 20 22 protected override void OnPaint(PaintEventArgs pe) { 21 23 try { 24 FireBeforePaint(pe); 25 22 26 Graphics g = pe.Graphics; 23 27 … … 38 42 base.OnResize(e); 39 43 } 44 45 private void FireBeforePaint(PaintEventArgs e) { 46 if (BeforePaint != null) 47 BeforePaint(this, e); 48 } 40 49 } 41 50 } -
trunk/sources/HeuristicLab.Visualization/3.2/ChartDataRowsModel.cs
r1876 r1880 5 5 using HeuristicLab.Core; 6 6 using System.Text; 7 using HeuristicLab.Visualization.LabelProvider;8 7 using HeuristicLab.Visualization.Options; 9 8 … … 15 14 public class ChartDataRowsModel : ChartDataModelBase, IChartDataRowsModel{ 16 15 private string title = "Title"; 17 private string xAxisLabel = "";18 private bool showXAxisLabel = true;19 private bool showXAxisGrid = true;20 private ILabelProvider labelProvider = new ContinuousLabelProvider("0.##");21 16 22 17 private ViewSettings viewSettings = new ViewSettings(); 23 18 24 public bool ShowXAxisGrid { 25 get { return showXAxisGrid; } 26 set { 27 this.showXAxisGrid = value; 28 OnModelChanged(); 29 } 19 private readonly XAxisDescriptor xAxisDescriptor = new XAxisDescriptor(); 20 21 public ChartDataRowsModel() { 22 this.XAxis.XAxisDescriptorChanged += delegate { OnModelChanged(); }; 30 23 } 31 24 32 public ILabelProvider XAxisLabelProvider { 33 get { return labelProvider; } 34 set{ 35 this.labelProvider = value; 36 OnModelChanged(); 37 } 25 public XAxisDescriptor XAxis { 26 get { return xAxisDescriptor; } 38 27 } 39 28 … … 52 41 53 42 private readonly List<IDataRow> rows = new List<IDataRow>(); 54 //private readonly List<string> xLabels = new List<string>();55 56 //public List<string> XLabels{57 // get { return xLabels; }58 //}59 43 60 44 public List<IDataRow> Rows{ … … 70 54 } 71 55 72 public string XAxisLabel {73 get { return xAxisLabel; }74 set {75 xAxisLabel = value;76 OnModelChanged();77 }78 }79 80 public bool ShowXAxisLabel {81 get { return showXAxisLabel; }82 set {83 showXAxisLabel = value;84 OnModelChanged();85 }86 }87 88 56 public override IView CreateView() { 89 57 return new LineChart(this); 90 58 } 91 92 //public void AddLabel(string label) {93 // xLabels.Add(label);94 // OnModelChanged();95 //}96 97 //public void AddLabel(string label, int index) {98 // xLabels[index] = label;99 // OnModelChanged();100 //}101 102 //public void AddLabels(string[] labels) {103 // foreach (var s in labels){104 // AddLabel(s);105 // }106 // //OnModelChanged();107 //}108 109 //public void AddLabels(string[] labels, int index) {110 // int i = 0;111 // foreach (var s in labels){112 // AddLabel(s, index + i);113 // i++;114 // }115 // //OnModelChanged();116 //}117 118 //public void ModifyLabel(string label, int index) {119 // xLabels[index] = label;120 // OnModelChanged();121 //}122 123 //public void ModifyLabels(string[] labels, int index) {124 // int i = 0;125 // foreach (var s in labels){126 // ModifyLabel(s, index + i);127 // i++;128 // }129 // //OnModelChanged();130 //}131 132 //public void RemoveLabel(int index) {133 // xLabels.RemoveAt(index);134 // OnModelChanged();135 //}136 137 //public void RemoveLabels(int index, int count) {138 // for (int i = index; i < index + count; i++ ){139 // RemoveLabel(i);140 // }141 // //OnModelChanged();142 //}143 59 144 60 private readonly YAxisDescriptor defaultYAxisDescriptor = new YAxisDescriptor(); … … 228 144 } 229 145 230 XmlNode labelProviderNode = document.ImportNode( labelProvider.GetLabelProviderXmlNode(), true);146 XmlNode labelProviderNode = document.ImportNode(XAxis.XAxisLabelProvider.GetLabelProviderXmlNode(), true); 231 147 node.AppendChild(labelProviderNode); 232 148 … … 239 155 foreach (XmlNode dataRow in node.ChildNodes) { 240 156 if (dataRow.Name.Equals("LabelProvider")) { 241 labelProvider = labelProvider.PopulateLabelProviderXmlNode(dataRow);157 XAxis.XAxisLabelProvider = XAxis.XAxisLabelProvider.PopulateLabelProviderXmlNode(dataRow); 242 158 } else { 243 159 XmlAttributeCollection attrs = dataRow.Attributes; -
trunk/sources/HeuristicLab.Visualization/3.2/DataExport/CSVDataExport.cs
r1781 r1880 27 27 28 28 // write headers 29 writer.AddString(model.XAxis Label);29 writer.AddString(model.XAxis.XAxisLabel); 30 30 foreach (IDataRow row in model.Rows) 31 31 writer.AddString(row.Label); -
trunk/sources/HeuristicLab.Visualization/3.2/HeuristicLab.Visualization-3.2.csproj
r1876 r1880 115 115 <Compile Include="LabelProvider\ContinuousLabelProvider.cs" /> 116 116 <Compile Include="LabelProvider\DiscreteLabelProvider.cs" /> 117 <Compile Include="XAxisDescriptor.cs" /> 117 118 <Compile Include="YAxisGrid.cs" /> 118 119 <Compile Include="HorizontalLineShape.cs" /> -
trunk/sources/HeuristicLab.Visualization/3.2/IChartDataRowsModel.cs
r1876 r1880 8 8 string Title { get; set; } 9 9 List<IDataRow> Rows { get; } 10 ILabelProvider XAxisLabelProvider { get; set; }11 10 11 XAxisDescriptor XAxis { get; } 12 12 List<YAxisDescriptor> YAxes { get; } 13 13 … … 19 19 ViewSettings ViewSettings { get; set; } 20 20 21 string XAxisLabel { get; set; }22 bool ShowXAxisLabel { get; set; }23 bool ShowXAxisGrid { get; set; }24 25 21 event ModelChangedHandler ModelChanged; 26 22 event DataRowAddedHandler DataRowAdded; -
trunk/sources/HeuristicLab.Visualization/3.2/LineChart.cs
r1879 r1880 58 58 this.ResizeRedraw = true; 59 59 60 canvasUI.BeforePaint += delegate { UpdateLayout(); }; 61 60 62 UpdateLayout(); 61 63 ZoomToFullView(); … … 78 80 SetLegendPosition(); 79 81 80 this.Invalidate(true);82 canvasUI.Invalidate(); 81 83 } 82 84 … … 89 91 titleShape.Text = model.Title; 90 92 91 if (model. ShowXAxisGrid) {93 if (model.XAxis.ShowXAxisGrid) { 92 94 canvas.AddShape(xAxisGrid); 93 95 } … … 105 107 } 106 108 107 xAxis.ShowLabel = model. ShowXAxisLabel;108 xAxis.Label = model.XAxis Label;109 xAxis.ShowLabel = model.XAxis.ShowXAxisLabel; 110 xAxis.Label = model.XAxis.XAxisLabel; 109 111 110 112 canvas.AddShape(xAxis); … … 246 248 legendShape.CreateLegend(); 247 249 248 this.Invalidate(true);250 canvasUI.Invalidate(); 249 251 } 250 252 … … 287 289 rowEntry.LinesShape.UpdateStyle(row); 288 290 289 this.Invalidate(true);291 canvasUI.Invalidate(); 290 292 } 291 293 … … 322 324 InitLineShapes(row); 323 325 324 this.Invalidate(true);326 canvasUI.Invalidate(); 325 327 } 326 328 … … 333 335 rowEntries.RemoveAll(delegate(RowEntry rowEntry) { return rowEntry.DataRow == row; }); 334 336 335 this.Invalidate(true);337 canvasUI.Invalidate(); 336 338 } 337 339 … … 349 351 } 350 352 351 this.Invalidate(true);353 canvasUI.Invalidate(); 352 354 } 353 355 … … 484 486 485 487 private void OnModelChanged() { 486 this.Invalidate(true);488 canvasUI.Invalidate(); 487 489 } 488 490 … … 503 505 504 506 if (beginUpdateCount == 0) { 505 this.Invalidate(true);507 canvasUI.Invalidate(); 506 508 } 507 509 } … … 523 525 } 524 526 525 this.Invalidate(true);527 canvasUI.Invalidate(); 526 528 } 527 529 … … 544 546 545 547 userInteractionShape.RemoveShape(rectangleShape); 546 this.Invalidate(true);548 canvasUI.Invalidate(); 547 549 } 548 550 549 551 private void DrawRectangle(Rectangle rectangle) { 550 552 rectangleShape.Rectangle = Transform.ToWorld(rectangle, userInteractionShape.Viewport, userInteractionShape.ClippingArea); 551 this.Invalidate(true);553 canvasUI.Invalidate(); 552 554 } 553 555 … … 615 617 } 616 618 617 this.Invalidate(true);619 canvasUI.Invalidate(); 618 620 } 619 621 } -
trunk/sources/HeuristicLab.Visualization/3.2/Options/Options.cs
r1876 r1880 66 66 67 67 public void ResetSettings() { 68 model. ShowXAxisGrid = oldShowXAxisGrid;68 model.XAxis.ShowXAxisGrid = oldShowXAxisGrid; 69 69 70 70 foreach (var param in oldLineParams) { … … 102 102 } 103 103 104 private IList<int> GetThicknesses() {104 private static IList<int> GetThicknesses() { 105 105 return new List<int>(new[] {1, 2, 3, 4, 5, 6, 7, 8}); 106 106 } 107 107 108 private IList<DrawingStyle> GetStyles() {108 private static IList<DrawingStyle> GetStyles() { 109 109 return new List<DrawingStyle>(new[] {DrawingStyle.Solid, DrawingStyle.Dashed}); 110 110 } … … 153 153 154 154 private void Options_Load(object sender, EventArgs e) { 155 oldShowXAxisGrid = model. ShowXAxisGrid;156 chkShowXAxisGrid.Checked = model. ShowXAxisGrid;155 oldShowXAxisGrid = model.XAxis.ShowXAxisGrid; 156 chkShowXAxisGrid.Checked = model.XAxis.ShowXAxisGrid; 157 157 158 158 InitTabPageLines(); … … 245 245 246 246 private void chkShowXAxisGrid_CheckedChanged(object sender, EventArgs e) { 247 model. ShowXAxisGrid = chkShowXAxisGrid.Checked;247 model.XAxis.ShowXAxisGrid = chkShowXAxisGrid.Checked; 248 248 } 249 249 -
trunk/sources/HeuristicLab.Visualization/3.2/Options/OptionsDialog.Designer.cs
r1586 r1880 60 60 // 61 61 this.options.Location = new System.Drawing.Point(2, 3); 62 chartDataRowsModel1. ShowXAxisLabel = true;62 chartDataRowsModel1.XAxis.ShowXAxisLabel = true; 63 63 chartDataRowsModel1.Title = "Title"; 64 64 viewSettings1.LegendColor = System.Drawing.Color.Blue; … … 70 70 viewSettings1.XAxisFont = new System.Drawing.Font("Arial", 8F); 71 71 chartDataRowsModel1.ViewSettings = viewSettings1; 72 chartDataRowsModel1.XAxis Label = "";73 chartDataRowsModel1.XAxis LabelProvider = continuousLabelProvider1;72 chartDataRowsModel1.XAxis.XAxisLabel = ""; 73 chartDataRowsModel1.XAxis.XAxisLabelProvider = continuousLabelProvider1; 74 74 this.options.Model = chartDataRowsModel1; 75 75 this.options.Name = "options";
Note: See TracChangeset
for help on using the changeset viewer.