An unexpected stack of bars and a line at the top

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Mth
Newbie
Newbie
Posts: 8
Joined: Thu Dec 30, 2021 12:00 am

An unexpected stack of bars and a line at the top

Post by Mth » Wed Dec 27, 2023 12:13 pm

Visual Studio 2022,
.net7.0 console project,
Steema.TeeChart.NET.Pro (4.2023.12.14)

Hi,

First problem: When the bar value exceeds the upper range of the chart axis, an unnecessary line is drawn at the top of the chart.

Second problem: When we add two series of bars, so that one is connected to the left axis and the other to the right axis, they unexpectedly stack up.


var mChart = new TChart();
mChart.Aspect.View3D = false;

mChart.Header.Visible = false;
mChart.Legend.Visible = false;

mChart.Axes.Left.AutomaticMinimum = false;
mChart.Axes.Left.Minimum = 0;
mChart.Axes.Left.AutomaticMaximum = false;
mChart.Axes.Left.Maximum = 100;

mChart.Axes.Right.AutomaticMinimum = false;
mChart.Axes.Right.Minimum = 0;
mChart.Axes.Right.AutomaticMaximum = false;
mChart.Axes.Right.Maximum = 100;

Bar bar = new Bar(mChart.Chart);
bar.Add(0, 60);
bar.Add(20, 140);
bar.Add(40, 60);
bar.Add(80, 80);
bar.Add(100, 160);
bar.MultiBar = MultiBars.Side;

Bar bar2 = new Bar(mChart.Chart);
bar2.Add(0, 20);
bar2.Add(20, 30);
bar2.Add(40, 40);
bar2.Add(80, 10);
bar2.Add(100, 50);
bar2.MultiBar = MultiBars.Side;
bar2.CustomVertAxis = mChart.Axes.Right;

mChart.Export.Image.PNG.Width = 800;
mChart.Export.Image.PNG.Height = 400;
mChart.Export.Image.PNG.Save($"D:\\TeeChartTest\\chart_7.png");

chart_7.png
chart_7.png (19.45 KiB) Viewed 1729 times

Marc
Site Admin
Site Admin
Posts: 1217
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: An unexpected stack of bars and a line at the top

Post by Marc » Wed Dec 27, 2023 3:25 pm

Hello,

Thank you for the bug report. Point 1 is reproducible. It may be an error with the clipping region at render time; we'll take a look. bug ref bug id 2663.

Point 2 can be corrected by alllocating the right axis in this way:

Code: Select all

bar2.VertAxis = VerticalAxis.Right;
If you wish to use a Custom Vertical Axis you must first define it. More info here:

Axes tutorial.

Regards,
Marc Meumann
Steema Support

Mth
Newbie
Newbie
Posts: 8
Joined: Thu Dec 30, 2021 12:00 am

Re: An unexpected stack of bars and a line at the top

Post by Mth » Fri Dec 29, 2023 10:37 am

Hello,
Thank you for your answer.
I will use VertAxis instead of CustomVertAxis.
I was porting the code from the .Net WinForms version in which the bar2.CustomVertAxis = mChart.Axes.Right; worked correctly even though bar2.VertAxis = VerticalAxis.Right; should probably have been used there as well.

Post Reply