Changeset 1337 for trunk/sources/HeuristicLab.Visualization
- Timestamp:
- 03/12/09 19:26:27 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.Visualization
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/sources/HeuristicLab.Visualization/HeuristicLab.Visualization.csproj ¶
r1325 r1337 100 100 <DependentUpon>OptionsDialog.cs</DependentUpon> 101 101 </Compile> 102 <Compile Include="Options\ViewPropertiesModel.cs" /> 102 103 <Compile Include="PanListener.cs" /> 103 104 <Compile Include="LabelProvider\StringLabelProvider.cs" /> -
TabularUnified trunk/sources/HeuristicLab.Visualization/Legend/LegendShape.cs ¶
r1240 r1337 1 1 using System.Collections.Generic; 2 using HeuristicLab.Visualization.Legend;2 using System.Drawing; 3 3 4 4 namespace HeuristicLab.Visualization.Legend { 5 5 public class LegendShape : WorldShape { 6 6 private readonly IList<LegendItem> legendItems = new List<LegendItem>(); 7 7 8 private Color color = Color.Blue; 9 private Font font = new Font("Arial", 8); 10 8 11 public LegendShape() { 9 12 CreateLegend(); … … 15 18 foreach (LegendItem item in legendItems) { 16 19 AddShape(new LineShape(10, y - 10, 30, y - 10, item.Color, item.Thickness, DrawingStyle.Solid)); 17 AddShape(new TextShape(35, y, item.Label ));20 AddShape(new TextShape(35, y, item.Label, font, color)); 18 21 y -= 15; 19 22 } … … 31 34 legendItems.Clear(); 32 35 } 36 37 public Color Color { 38 get { return color; } 39 set { 40 color = value; 41 UpdateTextShapes(); 42 } 43 } 44 45 public Font Font { 46 get { return font; } 47 set { 48 font = value; 49 UpdateTextShapes(); 50 } 51 } 52 53 private void UpdateTextShapes() { 54 foreach (IShape shape in shapes) { 55 TextShape textShape = shape as TextShape; 56 57 if (textShape != null) { 58 textShape.Font = font; 59 textShape.Color = color; 60 } 61 } 62 } 33 63 } 34 64 } -
TabularUnified trunk/sources/HeuristicLab.Visualization/LineChart.cs ¶
r1328 r1337 29 29 private bool zoomToFullView; 30 30 31 private readonly ViewPropertiesModel viewPropertiesModel; 32 31 33 /// <summary> 32 34 /// This constructor shouldn't be called. Only required for the designer. … … 34 36 public LineChart() { 35 37 InitializeComponent(); 36 }37 38 public TextShape Title {39 get { return titleShape; }40 }41 42 public LegendShape Legend {43 get { return legendShape; }44 38 } 45 39 … … 56 50 57 51 this.model = model; 52 viewPropertiesModel = new ViewPropertiesModel(titleShape.Font, titleShape.Color, legendShape.Font, legendShape.Color, xAxis.Font, xAxis.Color); 53 viewPropertiesModel.OnUpdateProperties += UpdateViewProperties; 58 54 59 55 Item = model; … … 63 59 64 60 ZoomToFullView(); 61 } 62 63 private void UpdateViewProperties() { 64 titleShape.Font = viewPropertiesModel.TitleFont; 65 titleShape.Color = viewPropertiesModel.TitleColor; 66 67 legendShape.Font = viewPropertiesModel.LegendFont; 68 legendShape.Color = viewPropertiesModel.LegendColor; 69 70 xAxis.Font = viewPropertiesModel.XAxisFont; 71 xAxis.Color = viewPropertiesModel.XAxisColor; 72 73 canvasUI.Invalidate(); 65 74 } 66 75 … … 136 145 137 146 private void optionsToolStripMenuItem_Click(object sender, EventArgs e) { 138 OptionsDialog optionsdlg = new OptionsDialog(this.model, this);147 OptionsDialog optionsdlg = new OptionsDialog(this.model, viewPropertiesModel); 139 148 optionsdlg.ShowDialog(this); 140 149 } -
TabularUnified trunk/sources/HeuristicLab.Visualization/Options/OptionsDialog.Designer.cs ¶
r1328 r1337 31 31 this.btnChangeTitleFont = new System.Windows.Forms.Button(); 32 32 this.tabPage2 = new System.Windows.Forms.TabPage(); 33 this.btnChangeLegendFont = new System.Windows.Forms.Button(); 34 this.labelposition = new System.Windows.Forms.Label(); 33 35 this.cbLabelPosition = new System.Windows.Forms.ComboBox(); 34 this.labelposition = new System.Windows.Forms.Label();35 36 this.tabPage1 = new System.Windows.Forms.TabPage(); 37 this.OptionsDialogSelectColorBt = new System.Windows.Forms.Button(); 38 this.ColorPreviewTB = new System.Windows.Forms.TextBox(); 39 this.label2 = new System.Windows.Forms.Label(); 40 this.LinestyleCB = new System.Windows.Forms.ComboBox(); 41 this.label1 = new System.Windows.Forms.Label(); 42 this.LineSelectCB = new System.Windows.Forms.ComboBox(); 36 43 this.groupBox1 = new System.Windows.Forms.GroupBox(); 44 this.label4 = new System.Windows.Forms.Label(); 45 this.LineThicknessCB = new System.Windows.Forms.ComboBox(); 37 46 this.label3 = new System.Windows.Forms.Label(); 38 this.LineThicknessCB = new System.Windows.Forms.ComboBox();39 this.label4 = new System.Windows.Forms.Label();40 this.LineSelectCB = new System.Windows.Forms.ComboBox();41 this.label1 = new System.Windows.Forms.Label();42 this.LinestyleCB = new System.Windows.Forms.ComboBox();43 this.label2 = new System.Windows.Forms.Label();44 this.ColorPreviewTB = new System.Windows.Forms.TextBox();45 this.OptionsDialogSelectColorBt = new System.Windows.Forms.Button();46 47 this.Optionstabs = new System.Windows.Forms.TabControl(); 47 this.btnChangeLegendFont = new System.Windows.Forms.Button(); 48 this.tpXAxis = new System.Windows.Forms.TabPage(); 49 this.btnChangeXAxisFont = new System.Windows.Forms.Button(); 48 50 this.tpTitle.SuspendLayout(); 49 51 this.tabPage2.SuspendLayout(); … … 51 53 this.groupBox1.SuspendLayout(); 52 54 this.Optionstabs.SuspendLayout(); 55 this.tpXAxis.SuspendLayout(); 53 56 this.SuspendLayout(); 54 57 // … … 119 122 this.tabPage2.Text = "Legend"; 120 123 this.tabPage2.UseVisualStyleBackColor = true; 124 // 125 // btnChangeLegendFont 126 // 127 this.btnChangeLegendFont.Location = new System.Drawing.Point(3, 6); 128 this.btnChangeLegendFont.Name = "btnChangeLegendFont"; 129 this.btnChangeLegendFont.Size = new System.Drawing.Size(94, 23); 130 this.btnChangeLegendFont.TabIndex = 2; 131 this.btnChangeLegendFont.Text = "Change Font"; 132 this.btnChangeLegendFont.UseVisualStyleBackColor = true; 133 this.btnChangeLegendFont.Click += new System.EventHandler(this.btnChangeLegendFont_Click); 134 // 135 // labelposition 136 // 137 this.labelposition.AutoSize = true; 138 this.labelposition.Location = new System.Drawing.Point(3, 47); 139 this.labelposition.Name = "labelposition"; 140 this.labelposition.Size = new System.Drawing.Size(72, 13); 141 this.labelposition.TabIndex = 1; 142 this.labelposition.Text = "Labelposition:"; 121 143 // 122 144 // cbLabelPosition … … 133 155 this.cbLabelPosition.Size = new System.Drawing.Size(121, 21); 134 156 this.cbLabelPosition.TabIndex = 0; 135 //136 // labelposition137 //138 this.labelposition.AutoSize = true;139 this.labelposition.Location = new System.Drawing.Point(3, 47);140 this.labelposition.Name = "labelposition";141 this.labelposition.Size = new System.Drawing.Size(72, 13);142 this.labelposition.TabIndex = 1;143 this.labelposition.Text = "Labelposition:";144 157 // 145 158 // tabPage1 … … 160 173 this.tabPage1.UseVisualStyleBackColor = true; 161 174 // 175 // OptionsDialogSelectColorBt 176 // 177 this.OptionsDialogSelectColorBt.Location = new System.Drawing.Point(217, 126); 178 this.OptionsDialogSelectColorBt.Name = "OptionsDialogSelectColorBt"; 179 this.OptionsDialogSelectColorBt.Size = new System.Drawing.Size(50, 23); 180 this.OptionsDialogSelectColorBt.TabIndex = 7; 181 this.OptionsDialogSelectColorBt.Text = "Select"; 182 this.OptionsDialogSelectColorBt.UseVisualStyleBackColor = true; 183 this.OptionsDialogSelectColorBt.Click += new System.EventHandler(this.OptionsDialogSelectColorBtn_Click); 184 // 185 // ColorPreviewTB 186 // 187 this.ColorPreviewTB.Location = new System.Drawing.Point(146, 127); 188 this.ColorPreviewTB.Name = "ColorPreviewTB"; 189 this.ColorPreviewTB.ReadOnly = true; 190 this.ColorPreviewTB.Size = new System.Drawing.Size(64, 20); 191 this.ColorPreviewTB.TabIndex = 6; 192 // 193 // label2 194 // 195 this.label2.AutoSize = true; 196 this.label2.Location = new System.Drawing.Point(36, 80); 197 this.label2.Name = "label2"; 198 this.label2.Size = new System.Drawing.Size(30, 13); 199 this.label2.TabIndex = 3; 200 this.label2.Text = "Style"; 201 // 202 // LinestyleCB 203 // 204 this.LinestyleCB.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 205 this.LinestyleCB.FormattingEnabled = true; 206 this.LinestyleCB.Location = new System.Drawing.Point(146, 73); 207 this.LinestyleCB.Name = "LinestyleCB"; 208 this.LinestyleCB.Size = new System.Drawing.Size(121, 21); 209 this.LinestyleCB.TabIndex = 2; 210 // 211 // label1 212 // 213 this.label1.AutoSize = true; 214 this.label1.Location = new System.Drawing.Point(7, 37); 215 this.label1.Name = "label1"; 216 this.label1.Size = new System.Drawing.Size(72, 13); 217 this.label1.TabIndex = 1; 218 this.label1.Text = "Selected Line"; 219 // 220 // LineSelectCB 221 // 222 this.LineSelectCB.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 223 this.LineSelectCB.FormattingEnabled = true; 224 this.LineSelectCB.Location = new System.Drawing.Point(146, 30); 225 this.LineSelectCB.Name = "LineSelectCB"; 226 this.LineSelectCB.Size = new System.Drawing.Size(121, 21); 227 this.LineSelectCB.TabIndex = 0; 228 this.LineSelectCB.SelectedIndexChanged += new System.EventHandler(this.LineSelectCB_SelectedIndexChanged); 229 // 162 230 // groupBox1 163 231 // … … 172 240 this.groupBox1.Text = "Details"; 173 241 // 242 // label4 243 // 244 this.label4.AutoSize = true; 245 this.label4.Location = new System.Drawing.Point(33, 77); 246 this.label4.Name = "label4"; 247 this.label4.Size = new System.Drawing.Size(31, 13); 248 this.label4.TabIndex = 8; 249 this.label4.Text = "Color"; 250 // 251 // LineThicknessCB 252 // 253 this.LineThicknessCB.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 254 this.LineThicknessCB.FormattingEnabled = true; 255 this.LineThicknessCB.Location = new System.Drawing.Point(142, 46); 256 this.LineThicknessCB.Name = "LineThicknessCB"; 257 this.LineThicknessCB.Size = new System.Drawing.Size(121, 21); 258 this.LineThicknessCB.TabIndex = 4; 259 // 174 260 // label3 175 261 // … … 181 267 this.label3.Text = "Thickness"; 182 268 // 183 // LineThicknessCB184 //185 this.LineThicknessCB.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;186 this.LineThicknessCB.FormattingEnabled = true;187 this.LineThicknessCB.Location = new System.Drawing.Point(142, 46);188 this.LineThicknessCB.Name = "LineThicknessCB";189 this.LineThicknessCB.Size = new System.Drawing.Size(121, 21);190 this.LineThicknessCB.TabIndex = 4;191 //192 // label4193 //194 this.label4.AutoSize = true;195 this.label4.Location = new System.Drawing.Point(33, 77);196 this.label4.Name = "label4";197 this.label4.Size = new System.Drawing.Size(31, 13);198 this.label4.TabIndex = 8;199 this.label4.Text = "Color";200 //201 // LineSelectCB202 //203 this.LineSelectCB.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;204 this.LineSelectCB.FormattingEnabled = true;205 this.LineSelectCB.Location = new System.Drawing.Point(146, 30);206 this.LineSelectCB.Name = "LineSelectCB";207 this.LineSelectCB.Size = new System.Drawing.Size(121, 21);208 this.LineSelectCB.TabIndex = 0;209 this.LineSelectCB.SelectedIndexChanged += new System.EventHandler(this.LineSelectCB_SelectedIndexChanged);210 //211 // label1212 //213 this.label1.AutoSize = true;214 this.label1.Location = new System.Drawing.Point(7, 37);215 this.label1.Name = "label1";216 this.label1.Size = new System.Drawing.Size(72, 13);217 this.label1.TabIndex = 1;218 this.label1.Text = "Selected Line";219 //220 // LinestyleCB221 //222 this.LinestyleCB.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;223 this.LinestyleCB.FormattingEnabled = true;224 this.LinestyleCB.Location = new System.Drawing.Point(146, 73);225 this.LinestyleCB.Name = "LinestyleCB";226 this.LinestyleCB.Size = new System.Drawing.Size(121, 21);227 this.LinestyleCB.TabIndex = 2;228 //229 // label2230 //231 this.label2.AutoSize = true;232 this.label2.Location = new System.Drawing.Point(36, 80);233 this.label2.Name = "label2";234 this.label2.Size = new System.Drawing.Size(30, 13);235 this.label2.TabIndex = 3;236 this.label2.Text = "Style";237 //238 // ColorPreviewTB239 //240 this.ColorPreviewTB.Location = new System.Drawing.Point(146, 127);241 this.ColorPreviewTB.Name = "ColorPreviewTB";242 this.ColorPreviewTB.ReadOnly = true;243 this.ColorPreviewTB.Size = new System.Drawing.Size(64, 20);244 this.ColorPreviewTB.TabIndex = 6;245 //246 // OptionsDialogSelectColorBt247 //248 this.OptionsDialogSelectColorBt.Location = new System.Drawing.Point(217, 126);249 this.OptionsDialogSelectColorBt.Name = "OptionsDialogSelectColorBt";250 this.OptionsDialogSelectColorBt.Size = new System.Drawing.Size(50, 23);251 this.OptionsDialogSelectColorBt.TabIndex = 7;252 this.OptionsDialogSelectColorBt.Text = "Select";253 this.OptionsDialogSelectColorBt.UseVisualStyleBackColor = true;254 this.OptionsDialogSelectColorBt.Click += new System.EventHandler(this.OptionsDialogSelectColorBtn_Click);255 //256 269 // Optionstabs 257 270 // … … 259 272 this.Optionstabs.Controls.Add(this.tabPage2); 260 273 this.Optionstabs.Controls.Add(this.tpTitle); 274 this.Optionstabs.Controls.Add(this.tpXAxis); 261 275 this.Optionstabs.Location = new System.Drawing.Point(0, 1); 262 276 this.Optionstabs.Name = "Optionstabs"; … … 265 279 this.Optionstabs.TabIndex = 0; 266 280 // 267 // btnChangeLegendFont 268 // 269 this.btnChangeLegendFont.Location = new System.Drawing.Point(3, 6); 270 this.btnChangeLegendFont.Name = "btnChangeLegendFont"; 271 this.btnChangeLegendFont.Size = new System.Drawing.Size(94, 23); 272 this.btnChangeLegendFont.TabIndex = 2; 273 this.btnChangeLegendFont.Text = "Change Font"; 274 this.btnChangeLegendFont.UseVisualStyleBackColor = true; 275 this.btnChangeLegendFont.Click += new System.EventHandler(this.btnChangeLegendFont_Click); 281 // tpXAxis 282 // 283 this.tpXAxis.Controls.Add(this.btnChangeXAxisFont); 284 this.tpXAxis.Location = new System.Drawing.Point(4, 22); 285 this.tpXAxis.Name = "tpXAxis"; 286 this.tpXAxis.Size = new System.Drawing.Size(284, 199); 287 this.tpXAxis.TabIndex = 3; 288 this.tpXAxis.Text = "X-Axis"; 289 this.tpXAxis.UseVisualStyleBackColor = true; 290 // 291 // btnChangeXAxisFont 292 // 293 this.btnChangeXAxisFont.Location = new System.Drawing.Point(3, 3); 294 this.btnChangeXAxisFont.Name = "btnChangeXAxisFont"; 295 this.btnChangeXAxisFont.Size = new System.Drawing.Size(94, 23); 296 this.btnChangeXAxisFont.TabIndex = 2; 297 this.btnChangeXAxisFont.Text = "Change Font"; 298 this.btnChangeXAxisFont.UseVisualStyleBackColor = true; 299 this.btnChangeXAxisFont.Click += new System.EventHandler(this.btnChangeXAxisFont_Click); 276 300 // 277 301 // OptionsDialog … … 297 321 this.groupBox1.PerformLayout(); 298 322 this.Optionstabs.ResumeLayout(false); 323 this.tpXAxis.ResumeLayout(false); 299 324 this.ResumeLayout(false); 300 325 … … 325 350 private System.Windows.Forms.TabControl Optionstabs; 326 351 private System.Windows.Forms.Button btnChangeLegendFont; 352 private System.Windows.Forms.TabPage tpXAxis; 353 private System.Windows.Forms.Button btnChangeXAxisFont; 327 354 } 328 355 } -
TabularUnified trunk/sources/HeuristicLab.Visualization/Options/OptionsDialog.cs ¶
r1328 r1337 6 6 public partial class OptionsDialog : Form { 7 7 private readonly IChartDataRowsModel model; 8 private readonly LineChart lineChart;8 private readonly ViewPropertiesModel propertiesModel; 9 9 10 public OptionsDialog(IChartDataRowsModel model, LineChart lineChart) {10 public OptionsDialog(IChartDataRowsModel model, ViewPropertiesModel propertiesModel) { 11 11 InitializeComponent(); 12 12 13 this.model = model; 13 this. lineChart = lineChart;14 this.propertiesModel = propertiesModel; 14 15 } 15 16 … … 71 72 ((IDataRow)LineSelectCB.SelectedValue).Style = (DrawingStyle)LinestyleCB.SelectedItem; 72 73 } 73 74 lineChart.Invalidate(true);75 74 } 76 75 77 76 private void btnChangeTitleFont_Click(object sender, EventArgs e) { 78 fdFont.Font = lineChart.Title.Font;79 fdFont.Color = lineChart.Title.Color;77 fdFont.Font = propertiesModel.TitleFont; 78 fdFont.Color = propertiesModel.TitleColor; 80 79 81 80 DialogResult dr = fdFont.ShowDialog(); 82 81 83 82 if(dr == DialogResult.OK) { 84 lineChart.Title.Font = fdFont.Font; 85 lineChart.Title.Color = fdFont.Color; 83 propertiesModel.TitleFont = fdFont.Font; 84 propertiesModel.TitleColor = fdFont.Color; 85 86 propertiesModel.UpdateView(); 86 87 } 87 88 } 88 89 89 90 private void btnChangeLegendFont_Click(object sender, EventArgs e) { 90 // fdFont.Font = lineChart.Legend.Font;91 // fdFont.Color = lineChart.Legend.Color;91 fdFont.Font = propertiesModel.LegendFont; 92 fdFont.Color = propertiesModel.LegendColor; 92 93 93 94 DialogResult dr = fdFont.ShowDialog(); 94 95 95 96 if (dr == DialogResult.OK) { 96 // lineChart.Legend.Font = fdFont.Font; 97 // lineChart.Legend.Color = fdFont.Color; 97 propertiesModel.LegendFont = fdFont.Font; 98 propertiesModel.LegendColor = fdFont.Color; 99 100 propertiesModel.UpdateView(); 101 } 102 } 103 104 private void btnChangeXAxisFont_Click(object sender, EventArgs e) { 105 fdFont.Font = propertiesModel.XAxisFont; 106 fdFont.Color = propertiesModel.XAxisColor; 107 108 DialogResult dr = fdFont.ShowDialog(); 109 110 if (dr == DialogResult.OK) { 111 propertiesModel.XAxisFont = fdFont.Font; 112 propertiesModel.XAxisColor = fdFont.Color; 113 114 propertiesModel.UpdateView(); 98 115 } 99 116 } -
TabularUnified trunk/sources/HeuristicLab.Visualization/TextShape.cs ¶
r1328 r1337 34 34 35 35 Color = Color.Blue; 36 } 37 38 public TextShape(double x, double y, string text, Font font, Color color) { 39 this.x = x; 40 this.y = y; 41 this.text = text; 42 Font = font; 43 Color = color; 36 44 } 37 45 -
TabularUnified trunk/sources/HeuristicLab.Visualization/XAxis.cs ¶
r1240 r1337 7 7 8 8 private ILabelProvider labelProvider = new ContinuousLabelProvider("0.####"); 9 10 private Color color = Color.Blue; 11 private Font font = new Font("Arial", 8); 9 12 10 13 public ILabelProvider LabelProvider { … … 20 23 ClippingArea.X1)) { 21 24 TextShape label = new TextShape(x, ClippingArea.Height - 3, 22 labelProvider.GetLabel(x) );25 labelProvider.GetLabel(x), Font, Color); 23 26 label.AnchorPositionX = AnchorPositionX.Middle; 24 27 label.AnchorPositionY = AnchorPositionY.Top; … … 28 31 base.Draw(graphics); 29 32 } 33 34 public Color Color { 35 get { return color; } 36 set { color = value; } 37 } 38 39 public Font Font { 40 get { return font; } 41 set { font = value; } 42 } 30 43 } 31 44 }
Note: See TracChangeset
for help on using the changeset viewer.