-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFormChartE.cs
More file actions
64 lines (58 loc) · 1.41 KB
/
FormChartE.cs
File metadata and controls
64 lines (58 loc) · 1.41 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
56
57
58
59
60
61
62
63
64
using System;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
namespace RapChessGui
{
public partial class FormChartE : Form
{
Series lastSeries = null;
public FormChartE()
{
InitializeComponent();
}
public void UpdateChart()
{
if (Visible == true)
{
chart1.Series.Clear();
CModeTournamentE.engineList.SortElo();
foreach (CEngine engine in CModeTournamentE.engineList)
{
string en = engine.name;
chart1.Series.Add(en);
chart1.Series[en].ChartType = SeriesChartType.Line;
chart1.Series[en].BorderWidth = 2;
FormChess.HisToPoints(engine.history, chart1.Series[en].Points);
}
}
}
private void FormHisE_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason != CloseReason.FormOwnerClosing)
{
Hide();
e.Cancel = true;
}
}
private void FormHisE_VisibleChanged(object sender, EventArgs e)
{
UpdateChart();
}
private void chart1_MouseDown(object sender, MouseEventArgs e)
{
if (lastSeries != null)
{
lastSeries.BorderWidth = 2;
lastSeries = null;
}
Chart plot = sender as Chart;
HitTestResult result = plot.HitTest(e.X, e.Y);
if (result != null && result.Object != null && result.ChartElementType == ChartElementType.LegendItem)
{
string name = result.Series.Name;
lastSeries = plot.Series[name];
lastSeries.BorderWidth = 4;
}
}
}
}