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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
private void disegnaIstogrammi(Rectangle viewPort, Tuple<Dictionary<double, int>, Dictionary<decimal, int>, Dictionary<decimal, int>> tuple)
{
int i = 0;
SolidBrush semiTransBrush = new SolidBrush(Color.FromArgb(128, 0, 0, 0));
foreach (var v in tuple.Item1)
{
int x, y;
int width, height;
// in this case on the fly trasformation is way faster
x = (int)(this.viewPort.Left + 20 * i);
y = (int)(viewPort.Top + viewPort.Height / 4 - v.Value / 10);
width = 15;
height = v.Value / 10;
Rectangle rectangle = new Rectangle(x, y, width, height);
g2.DrawRectangle(Pens.Black, rectangle);
g2.FillRectangle(semiTransBrush, rectangle);
g2.FillRectangle(Brushes.Cyan, rectangle);
g2.DrawString(((decimal)v.Key).ToString(), new Font("Calibri", 10.0f,
FontStyle.Regular, GraphicsUnit.Pixel), semiTransBrush, new Point(x, y+v.Value/10+1));
i++;
}
g2.DrawString("Distribuzione originale ", new Font("Calibri", 13.0f,
FontStyle.Italic, GraphicsUnit.Pixel), semiTransBrush, new Point(this.viewPort.Left - 140, (viewPort.Top + viewPort.Height/4)));
i = 0;
foreach (var v in tuple.Item2)
{
int x, y;
int width, height;
// in this case on the fly trasformation is way faster
x = (int)(this.viewPort.Left + 20 * i);
y = (int)(viewPort.Top + viewPort.Height /2 - v.Value / 2);
width = 15;
height = v.Value / 2;
Rectangle rectangle = new Rectangle(x, y, width, height);
g2.DrawRectangle(Pens.Black, rectangle);
g2.FillRectangle(semiTransBrush, rectangle);
g2.FillRectangle(Brushes.Cyan, rectangle);
g2.DrawString(v.Key.ToString(), new Font("Calibri", 10.0f,
FontStyle.Regular, GraphicsUnit.Pixel), semiTransBrush, new Point(x, y+v.Value/2));
i++;
}
g2.DrawString("Min ", new Font("Calibri", 13.0f,
FontStyle.Italic, GraphicsUnit.Pixel), semiTransBrush, new Point(this.viewPort.Left - 50, (viewPort.Top + viewPort.Height/2)));
i = 0;
foreach (var v in tuple.Item3)
{
int x, y;
int width, height;
// in this case on the fly trasformation is way faster
x = (int)(this.viewPort.Left + 20 * i);
y = (int)(viewPort.Top + viewPort.Height -30 - v.Value /2);
width = 15;
height = v.Value / 2;
Rectangle rectangle = new Rectangle(x, y, width, height);
g2.DrawRectangle(Pens.Black, rectangle);
g2.FillRectangle(semiTransBrush, rectangle);
g2.FillRectangle(Brushes.Cyan, rectangle);
g2.DrawString(v.Key.ToString(), new Font("Calibri", 10.0f,
FontStyle.Regular, GraphicsUnit.Pixel), semiTransBrush, new Point(x, y+v.Value/2));
i++;
}
g2.DrawString("Max ", new Font("Calibri", 13.0f,
FontStyle.Italic, GraphicsUnit.Pixel), semiTransBrush, new Point(this.viewPort.Left - 50, (viewPort.Top + viewPort.Height-30 )));
}
|