Bonjour à tous, j'ai pris la décision d'utiliser ChartFX Lite pour réaliser des graphs dans mon applications C#.
Alors voilà, j'ai un datagridview, avec 2 colonnes: date,prix. Je voudrais donc réaliser un graphique de ces données, mais je n'arrive pas à coder le processus...
Voilà ce que j'ai fait pour l'instant:
Mais ça m'affiche que "L'index était hors limites. In ne doit pas etre négatif et doit etre inférieur à la taille de la collection.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 string num_string = dataGridView3.RowCount.ToString(); int num = Convert.ToInt32(num_string); int i = 0; int ymax = 0; CGraph.ToolBar = true; CGraph.Gallery = Gallery.Bar; CGraph.Border = true; CGraph.Chart3D = true; CGraph.Grid = ChartGrid.Horz | ChartGrid.Vert; CGraph.AxisY.Max = ymax; CGraph.AxisY.Min = 0; CGraph.OpenData(COD.Values, 1, num); for (int ligne = 0 ; ligne <= num ;) { string date = (string)dataGridView3.Rows[i].Cells[0].Value.ToString(); double prix = (double)dataGridView3.Rows[i].Cells[1].Value; CGraph.Value[0,i] = prix; CGraph.Legend[i] = date; ligne++; i++;
nom du paramètre: index."
Et quand je bidouille, parfois en cliquant continuer, ça m'affiche mes données en graph, et parfois ça m'affiche pas la valeur des données...bref c'est le binz!
Pouvez-vous m'aider s'il vous plait?
Partager