Riporto parte di codice relativo alla definizione del chart, spero ti riferisca a questo:
codice:
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
this.chart0 = new System.Windows.Forms.DataVisualization.Charting.Chart();
((System.ComponentModel.ISupportInitialize)(this.chart0)).BeginInit();
this.chart0.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.chart0.BackColor = System.Drawing.Color.Transparent;
chartArea1.Name = "ChartArea1";
this.chart0.ChartAreas.Add(chartArea1);
legend1.Name = "Legend1";
this.chart0.Legends.Add(legend1);
this.chart0.Location = new System.Drawing.Point(0, 1);
this.chart0.Name = "chart0";
series1.ChartArea = "ChartArea1";
series1.Legend = "Legend1";
series1.Name = "Series1";
this.chart0.Series.Add(series1);
this.chart0.Size = new System.Drawing.Size(1143, 212);
this.chart0.TabIndex = 0;
this.chart0.Text = "chart0";
this.chart0.MouseClick += new System.Windows.Forms.MouseEventHandler(this.chart_Click);
this.chart0.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart_MouseMove);
this.Controls.Add(this.chart0);
((System.ComponentModel.ISupportInitialize)(this.chart0)).EndInit();
Successivamente, in fase di esecuzione l'utente selezionerà alcune informazioni e tramite la funzione addPoint() inserirò dati nella series[0] del chart su una Form separata ed effettuerò la seguente configurazione:
codice:
chart0.ChartAreas[0].Axes[0].Title = "label_x";
chart0.ChartAreas[0].Axes[1].Title = "label_y";
chart0.ChartAreas[0].Axes[1].LabelStyle.TruncatedLabels = true;
chart0.ChartAreas[0].AxisY.MaximumAutoSize = 12;
chart0.ChartAreas[0].AxisY.Interval = ((chart0.ChartAreas[0].AxisY.Maximum - chart0.ChartAreas[0].AxisY.Minimum) / 8);
chart0.ChartAreas[0].AxisX.MajorGrid.Enabled = false;
chart0.ChartAreas[0].CursorX.LineColor = Color.Blue;
chart0.ChartAreas[0].Position.Y = 0;
chart0.ChartAreas[0].Position.Height = 100;
chart0.ChartAreas[0].Position.X = 0;
chart0.ChartAreas[0].Position.Width = 87;
chart0.Legends[0].BackColor = Color.Transparent;
chart0.ChartAreas[0].Axes[1].LabelStyle.Format = "0.000";
...