Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 2129

Summary: Mulitple axis with larger labels do not fit in the window/panel
Product: .NET TeeChart Reporter: priyanka.shelke
Component: ChartAssignee: Steema Issue Manager <issuemanager>
Status: IN_PROGRESS ---    
Severity: enhancement CC: chris
Priority: ---    
Version: TeeChart for .Net 4.1.2015.03114   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Chart Series: --- Delphi / C++ Builder RAD IDE Version:
Attachments: Labels cut
code screenshot

Description priyanka.shelke 2018-11-23 06:26:56 EST
Created attachment 871 [details]
Labels cut

Hello,

We have a requirement that multiple custom y-axis are to be attached to the chart
The labels of the Y-axis are too large. So the labels for the last axis are not visible sometimes or cut sometimes.
I need a solution that will fit as many axis as provided in the chart along with proper label display(readable)
Please find the attachment to get the understanding of the problem area
I have gone through the forums but could not find that solution.

We would really appreciate if you provide a solution at the earliest as we are under high customer pressure to complete this issue
Comment 1 christopher ireland 2018-11-23 07:26:58 EST
Hello!

would you please be so kind as to pass us some C# (or VB.NET) code with which we can reproduce the issue you show in your image? If we can quickly reproduce your issue here we will quickly be able to resolve it for you.

Thank you.
Comment 2 priyanka.shelke 2018-11-25 22:34:07 EST
Hello,

Please find below code : 



//Code to generate points for axis

  private ObservableCollection<Point> GetPoints()
        {
            var points = new ObservableCollection<Point>();
            for (int i = 0; i < 5; i++)
            {
                var random = new Random();
                points.Add(new Point() {X = random.Next(), Y = random .Next()});
            }
            return points;
        }

 //Create multiple Y- axis  using following code
// Label A start
  var axis = new Axis
                        {
                            Visible = true,
                            Horizontal = false,
                            Title = new AxisTitle
                            {
                                Text = axisName + "[" + unit + "]"
                            },
                            Chart = SteemaTChartReference.Chart,
                            MinimumOffset = 0,
                            MaximumOffset = 100
                        };
SteemaTChartReference.Axes.Custom.Add(axis)

//Create series using Line
var series = new Line();
var points = GetPoints();
foreach(var point in points)
series.Add(point)
//Label A end 

create multiple series with different Y axis (Label A start to End)
PlaceAxes() is called to locate the axis after creation of multiple axes

You can replicate it this way.
Comment 3 christopher ireland 2018-11-26 03:45:49 EST
Created attachment 872 [details]
code screenshot

this 'code screenshot' was obtained using the following code:

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private void InitializeChart()
		{
			for (int i = 0; i < 3; i++)
			{
				CreateSeries();
			}
		}

		private Random random = new Random();

		private ObservableCollection<Point> GetPoints()
		{
			var points = new ObservableCollection<Point>();
			for (int i = 0; i < 5; i++)
			{
				points.Add(new Point() { X = random.Next(), Y = random.Next() });
			}
			return points;
		}

		private void CreateSeries()
		{
			var series = new Line();
			tChart1.Series.Add(series);

			var points = GetPoints();
			foreach (var point in points)
				series.Add(point.X, point.Y);
			PlaceAxes(series);
		}

		private void PlaceAxes(Series series)
		{
			int space = 120;

			var axis = new Axis
			{
				Visible = true,
				Horizontal = false,
				Title = new AxisTitle
				{
					Text = "Name" + "[" + "unit" + "]",
					Angle = 90
				},
				Chart = tChart1.Chart,
				MinimumOffset = 0,
				MaximumOffset = 100,
				PositionUnits = PositionUnits.Pixels,
				RelativePosition = -space * (tChart1.Series.Count - 1)
			};

			series.CustomVertAxis = axis;
			tChart1.Axes.Custom.Add(axis);

			tChart1.Panel.MarginUnits = PanelMarginUnits.Pixels;
			tChart1.Panel.MarginLeft = space * tChart1.Series.Count;
		}
	}

do you obtain the same image using the same code on your machine?