private void Button1_Click(object sender, EventArgs e) { RitSamenVatting Rit = new RitSamenVatting(); int NodeNr = 0; string[] filePaths = Directory.GetFiles(@"C:\Users\Michiel\Documents\Bryton\", "*.bdx"); foreach (string naam in filePaths) { Rit = XMLLezen.LeesXMLSamenVatting(naam); Ritten.Add(Rit); AddRitToTreeview(Rit, NodeNr); NodeNr += 1; } }
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { RitSamenVatting Rit = new RitSamenVatting(); List <LogPoint> LogPoints = new List <LogPoint>(); double xTeller = 1; if (e.Node.Parent == null) //e.Node.Parent.GetType() == typeof(TreeNode)) { treeView1.CollapseAll(); Rit = Ritten[e.Node.Index]; treeView1.Nodes[e.Node.Index].ExpandAll(); } LogPoints = XMLLezen.LeesLogPointsUitXML(Rit.BestandsNaam); while (chart1.Series.Count > 0) { chart1.Series.RemoveAt(0); } while (chart1.Legends.Count > 0) { chart1.Legends.RemoveAt(0); } while (chart1.Titles.Count > 0) { chart1.Titles.RemoveAt(0); } chart1.ChartAreas["ChartArea1"].AxisY2.Enabled = AxisEnabled.True; chart1.Titles.Add("bestand"); chart1.Titles[0].Text = Rit.BestandsNaam; if (chart1.Series.IsUniqueName("Cadance")) { chart1.Series.Add("Cadance"); chart1.Legends.Add(new Legend("Cadances")); chart1.Series[0].LegendText = "Cadance"; chart1.Legends[0].DockedToChartArea = "ChartArea1"; chart1.Series[0].YAxisType = AxisType.Secondary; } if (chart1.Series.IsUniqueName("HartRate")) { chart1.Series.Add("HartRate"); chart1.Legends.Add(new Legend("HartRate")); chart1.Series[1].LegendText = "HartRate"; chart1.Legends[1].DockedToChartArea = "ChartArea1"; chart1.Series[1].YAxisType = AxisType.Secondary; } if (chart1.Series.IsUniqueName("Speed")) { chart1.Series.Add("Speed"); chart1.Legends.Add(new Legend("Speed")); chart1.Series[2].LegendText = "Speed"; chart1.Legends[2].DockedToChartArea = "ChartArea1"; } foreach (LogPoint lp in LogPoints) { chart1.Series[0].Points.AddXY(xTeller, lp.Cadance); chart1.Series[1].Points.AddXY(xTeller, lp.Hartrate); chart1.Series[2].Points.AddXY(xTeller, lp.Speed); xTeller += 1; } chart1.Series[0].ChartType = SeriesChartType.FastLine; chart1.Series[0].Color = Color.Blue; chart1.Series[1].ChartType = SeriesChartType.FastLine; chart1.Series[1].Color = Color.Red; chart1.Series[2].ChartType = SeriesChartType.FastLine; chart1.Series[2].Color = Color.Cyan; }