-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFormChartB.cs
More file actions
65 lines (58 loc) · 1.4 KB
/
FormChartB.cs
File metadata and controls
65 lines (58 loc) · 1.4 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
65
using System;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
namespace RapChessGui
{
public partial class FormChartB : Form
{
Series lastSeries = null;
public FormChartB()
{
InitializeComponent();
}
public void UpdateChart()
{
if (Visible == true)
{
chart1.Series.Clear();
CModeTournamentB.bookList.SortElo();
foreach (CBook book in CModeTournamentB.bookList)
{
string bn = book.name;
chart1.Series.Add(bn);
chart1.Series[bn].ChartType = SeriesChartType.Line;
chart1.Series[bn].BorderWidth = 2;
FormChess.HisToPoints(book.history, chart1.Series[bn].Points);
}
}
}
private void FormHisB_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason != CloseReason.FormOwnerClosing)
{
Hide();
e.Cancel = true;
}
}
private void FormHisB_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;
}
}
}
}