private static void setSerieFromChart(TabloidConfigView table, TabloidConfigGraph graph, Chart chart, bool main, ref string champX) { //int points = 0; ////For every row in the values table, plot the date against the variable value //foreach (DataRow row in Values.Rows) //{ // myChart.Series[Variable].Points.AddXY(Convert.ToDateTime(row["Date"].ToString()), row["Variable"].ToString()); // myChart.Series[Variable].Points[points].ToolTip = Variable + " = #VALY \r\nDate = #VALX{d} \r\nSerial = " + row["Serial"].ToString(); // points += 1; //} if (main) { champX = table.Colonnes.Contains(graph.ChampX) ? table.Colonnes[graph.ChampX].Titre : ChampTools.RemoveTableName(graph.ChampX); } var serieName = string.IsNullOrEmpty(graph.Serie) ? "g" + chart.Series.Count : graph.Serie; var g = chart.Series.Add(serieName); g.ChartType = (SeriesChartType)graph.Type; g.XValueMember = champX; // TODO use dbkey g.YValueMembers = "Valeur" + chart.Series.Count; g.LabelForeColor = graph.CouleurEtiquette; g["PieLabelStyle"] = "Outside"; g.Label = graph.Etiquette; }
private static void getChartSeries(TabloidConfigView table, TabloidConfigGraph graph, Chart chart, ref string champX) { chart.Series.Clear(); setSerieFromChart(table, graph, chart, true, ref champX); foreach (TabloidConfigGraph g in graph.Graphiques) { setSerieFromChart(table, g, chart, false, ref champX); } }
public GraphForm(TabloidConfigView view, TabloidConfigGraph graph = null, TabloidConfigGraph parent = null) { InitializeComponent(); _currentGraph = graph; _view = view; _update = _currentGraph != null; _parentGraph = parent; if (!_update)//new { _currentGraph = new TabloidConfigGraph(); } else//edit existing { UpdatewizardView(); } SetFieldLists(); propertyGrid1.SelectedObject = _currentGraph; UpdateGraph(); }