This posts references .Net 4.0 and Steema TeeChart for .NET 2017 4.1.2017.03140
Edited compliment out and placed into the proper thread: http://www.teechart.net/support/viewtop ... 413#p73467
We are still having problems with angled text and separation values.
Here is separation of 0: (problem #1 with descenders and ascenders overlapping)
Here is separation of 1: (problem #2 labels all but disappear when they could have been drawn every other one.)
Take a form and place a TChart and a button on the form. The code will take care of arranging things and the size of things.
Using the code below run the application to see overlaps in descenders and ascenders.
Also, push the button to see the problem between separation of 0 and 1. The labels all but disappear but could have been drawn every other label and had a separation of one percent.
So there are two problems:
- Ascenders and descenders overlap when allowing the user to resize the chart with separation of 0.
- Separation of 1 percent is not one percent but huge with even a one degree of angled text.
Code: Select all
using Steema.TeeChart;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LabelSeparation
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.Size = new Size(670, 509);
this.button1.Location = new Point(34, 1);
this.button1.Click += button1_Click;
InitializeChart();
}
private void InitializeChart()
{
tChart1.Location = new Point(29, 36);
tChart1.Size = new Size(600, 400);
tChart1.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
tChart1.Aspect.View3D = false;
tChart1.Legend.Visible = false;
tChart1.Header.Visible = false;
Steema.TeeChart.Styles.Series TheSeries = new Steema.TeeChart.Styles.Bar();
TheSeries.Marks.Visible = false;
tChart1.Series.Add(TheSeries);
tChart1.Axes.Bottom.Labels.Font = new Steema.TeeChart.Drawing.ChartFont(tChart1.Chart, new Font("Arial", 9.7F, FontStyle.Regular));
TheSeries.Add(0, 273423155, "Facilities");
TheSeries.Add(1, 201478304, "Information Tech...");
TheSeries.Add(2, 184443667, "Externals, Financi...");
TheSeries.Add(3, 177618980, "Marketing Adverti...");
TheSeries.Add(4, 113353935, "Human Resources");
TheSeries.Add(5, 93689069, "General & Admini...");
TheSeries.Add(6, 51526793, "Travel");
TheSeries.Add(7, 28238498, "Exempt");
TheSeries.Add(8, 16809770, "Other");
tChart1.Axes.Bottom.Labels.Angle = 30;
tChart1.Axes.Bottom.Labels.Style = AxisLabelStyle.Auto;
tChart1.Axes.Bottom.Labels.Separation = 0;
this.Height = 400;
this.Width = 367;
}
private void button1_Click(object sender, EventArgs e)
{
if (tChart1.Axes.Bottom.Labels.Separation == 0)
tChart1.Axes.Bottom.Labels.Separation = 1;
else
tChart1.Axes.Bottom.Labels.Separation = 0;
}
}
}