-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathElementVisualizer.cs
More file actions
55 lines (46 loc) · 1.74 KB
/
ElementVisualizer.cs
File metadata and controls
55 lines (46 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
namespace AutomatedLIBS {
public partial class ElementVisualizer : Form {
private Dictionary<string, double> mIntegrals;
public ElementVisualizer(Dictionary<string, double> integrals) {
InitializeComponent();
mIntegrals = integrals;
}
private void ElementVisualizer_Load(object sender, EventArgs e) {
chrElements.Series.Clear();
chrElements.Series.Add("Elements");
foreach(var kv in mIntegrals) {
chrElements.Series["Elements"].Points.AddXY(kv.Key, kv.Value);
}
chrElements.Series["Elements"].ChartType = SeriesChartType.Column;
}
private void ElementVisualizer_Resize(object sender, EventArgs e) {
chrElements.Size = new Size(ClientSize.Width, ClientSize.Height);
}
private void chrElements_Click(object sender, EventArgs e) {
}
private void btnSave_Click(object sender, EventArgs e) {
var dlg = new SaveFileDialog();
dlg.Filter = "txt files (*.txt)|*.txt";
if (dlg.ShowDialog() == DialogResult.OK) {
var s = new StreamWriter(dlg.FileName);
foreach(var kv in mIntegrals) {
s.WriteLine(kv.Key + "\t" + kv.Value);
}
s.Close();
}
}
}
}