Skip to content

Commit 9d3c0ca

Browse files
Commit
1 parent 789249e commit 9d3c0ca

File tree

1 file changed

+11
-65
lines changed

1 file changed

+11
-65
lines changed

ParallelCoordinateChart/ParallelCoordinateChart/ParallelCoordinateChart.cs

Lines changed: 11 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -109,41 +109,19 @@ private List<NumericalAxis> GenerateYAxesList()
109109
yAxis.Interval = 4;
110110
yAxis.CrossesAt = 0;
111111
yAxis.EdgeLabelsDrawingMode = EdgeLabelsDrawingMode.Fit;
112+
113+
string[] years = Enumerable.Range(1995, 29).Select(y => y.ToString()).ToArray();
114+
112115
yAxis.LabelCreated += (s, e) =>
113116
{
114-
e.Label = e.Position switch
117+
if (e.Position >= 0 && e.Position < years.Length)
118+
{
119+
e.Label = years[(int)e.Position];
120+
}
121+
else
115122
{
116-
0 => "1995",
117-
1 => "1996",
118-
2 => "1997",
119-
3 => "1998",
120-
4 => "1999",
121-
5 => "2000",
122-
6 => "2001",
123-
7 => "2002",
124-
8 => "2003",
125-
9 => "2004",
126-
10 => "2005",
127-
11 => "2006",
128-
12 => "2007",
129-
13 => "2008",
130-
14 => "2009",
131-
15 => "2010",
132-
16 => "2011",
133-
17 => "2012",
134-
18 => "2013",
135-
19 => "2014",
136-
20 => "2015",
137-
21 => "2016",
138-
22 => "2017",
139-
23 => "2018",
140-
24 => "2019",
141-
25 => "2020",
142-
26 => "2021",
143-
27 => "2022",
144-
28 => "2023",
145-
_ => string.Empty
146-
};
123+
e.Label = string.Empty;
124+
}
147125
};
148126
break;
149127

@@ -278,39 +256,7 @@ private double Normalize(double value, double min, double max)
278256

279257
private int YearIndex(string year)
280258
{
281-
return year switch
282-
{
283-
"1995" => 0,
284-
"1996" => 1,
285-
"1997" => 2,
286-
"1998" => 3,
287-
"1999" => 4,
288-
"2000" => 5,
289-
"2001" => 6,
290-
"2002" => 7,
291-
"2003" => 8,
292-
"2004" => 9,
293-
"2005" => 10,
294-
"2006" => 11,
295-
"2007" => 12,
296-
"2008" => 13,
297-
"2009" => 14,
298-
"2010" => 15,
299-
"2011" => 16,
300-
"2012" => 17,
301-
"2013" => 18,
302-
"2014" => 19,
303-
"2015" => 20,
304-
"2016" => 21,
305-
"2017" => 22,
306-
"2018" => 23,
307-
"2019" => 24,
308-
"2020" => 25,
309-
"2021" => 26,
310-
"2022" => 27,
311-
"2023" => 28,
312-
_ => -1
313-
};
259+
return int.TryParse(year, out int yearInt) ? yearInt - 1995 : -1;
314260
}
315261
}
316262
}

0 commit comments

Comments
 (0)