Tiago Tiago - 9 months ago 72
C# Question

C# Windows Forms Chart is weird

I made a C# windows forms and my chart is very strange. My chart has a lot of white borders and the text for Master and Slave is very tiny and pixelated.

Why the Axis is so far away from the borders? How can I fix this?

enter image description here

// chart1
chartArea2.AxisX.MajorGrid.Enabled = false;
chartArea2.AxisX.MajorTickMark.Enabled = false;
chartArea2.AxisY.MajorGrid.Enabled = false;
chartArea2.AxisY.MajorTickMark.Enabled = false;
chartArea2.Name = "ChartArea1";
legend2.Name = "Legend1";
this.chart1.Location = new System.Drawing.Point(543, 49);
this.chart1.Name = "chart1";
series3.ChartArea = "ChartArea1";
series3.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
series3.Legend = "Legend1";
series3.MarkerBorderColor = System.Drawing.Color.Black;
series3.MarkerImage = "C:\\Users\\Tiago\\Desktop\\CODIGO_TESE_FINAL_BACKUP1408_BOM\\C# - AR.Drone SDK\\AR.Dron" +
series3.MarkerImageTransparentColor = System.Drawing.Color.Red;
series3.Name = "Master";
series4.ChartArea = "ChartArea1";
series4.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
series4.Legend = "Legend1";
series4.MarkerImage = "C:\\Users\\Tiago\\Desktop\\CODIGO_TESE_FINAL_BACKUP1408_BOM\\C# - AR.Drone SDK\\AR.Dron" +
series4.Name = "Slave";
this.chart1.Size = new System.Drawing.Size(1159, 359);
this.chart1.TabIndex = 7;
this.chart1.Text = "chart1";
this.chart1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.chart1_MouseDown);
this.chart1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart1_MouseMove);
this.chart1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.chart1_MouseUp);


You can set the border spaces and the Fonts all in the designer.

Pick the ChartArea and modify the Position. Note that it is not in pixels but in percentages of the Chart.ClientSize!! So for your largish chart the 3% defualt is a little too much..

enter image description here

The Legend's Font is changed here:

enter image description here