按出栈的顺序先全部隐藏
然后按入栈的顺序显示Series
for (int i = chartControl1.Series.Count -1 ; i >= 0; i--) { //出栈顺序隐藏全部
chartControl1.Series[i].Visible = false;
}
for (int i = 0; i < chartControl1.Series.Count; i++) { //入栈顺序选择性显示
if (showArr.Contains( i + 1 )) {//包含(i+1)
chartControl1.Series[i].Visible = true;
}
}
否则
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll
Additional information: 索引超出范围。必须为非负值并小于集合大小。