Jump to content
TurboMagic

TChart bottom axis label issue

Recommended Posts

Hello,

 

I've got a 2D TChart with 2 bar series in Delphi 12.3 (included Standard edition oif TChart).

Both are set to Stack -> Side all, because the 1st series shall use the left axis, the 2nd series shall use the right axis.

 

Bottom axis label format has been set to text and when clicking a button in the application I add a few bars for both

series like this:

Chart.Series[0].Add(5, 'Bar name1 Series 1');

Chart.Series[1].Add(500, 'Bar name1 Series 2');

 

It displays the labels on the bars of the 1st series but never on the 2nd series.
Attached is my test application.

 

Another question would be if it is possible to have a custom setting for the Marks position for an individual bar of a series.
Or asked otherwise: as can seen in my demo I aligned the marks so that they are painted over the bar from the upper end
of the bar. This is good, except for bars with a 0 value as the 0 is the painted into the bottom axis. I wanted to avoid that one
for such bars but keep the mark painted over the bar and not on top of it.

 

Last question: I cannot seem to register a login for the support forums on steema.com. I do not find a way to do so and the
admin contact page is disabled as well. Anybody any clue whether this is intentional or how to desl with this?

ChartTest.zip

Share this post


Link to post
On 6/4/2025 at 12:12 PM, TurboMagic said:

It displays the labels on the bars of the 1st series but never on the 2nd series.

The chart by default draws the labels for the first series in the chart.

You could add the labels of the second series as "custom labels". Ie:

 

  Chart1.Draw;
  for i:=0 to Chart1.Series[1].Count-1 do
    Chart1.Axes.Bottom.Items.Add(Chart1.Axes.Bottom.Items.Count, Chart1.Series[1].Labels[i]);
  Chart1.Draw;

 

On 6/4/2025 at 12:12 PM, TurboMagic said:

Another question would be if it is possible to have a custom setting for the Marks position for an individual bar of a series.
Or asked otherwise: as can seen in my demo I aligned the marks so that they are painted over the bar from the upper end
of the bar. This is good, except for bars with a 0 value as the 0 is the painted into the bottom axis. I wanted to avoid that one
for such bars but keep the mark painted over the bar and not on top of it. 

 

You can use OnGetMarkText event to intercept the marks drawing and empty them according to any condition you define.

In this example I've set the threshold to 7000 because I don't see any 0 value in your test project:

 

procedure TForm2.FormCreate(Sender: TObject);
begin
  Chart1.Series[0].OnGetMarkText:=SeriesGetMarkText;
end;

procedure TForm2.SeriesGetMarkText(Sender:TChartSeries; ValueIndex:Integer; var MarkText:String);
const threshold = 7000;
begin
  if Assigned(Sender) and (ValueIndex > -1) and (Sender.YValue[ValueIndex] < threshold) then
     MarkText := '';
end;

 

On 6/4/2025 at 12:12 PM, TurboMagic said:

Last question: I cannot seem to register a login for the support forums on steema.com. I do not find a way to do so and the
admin contact page is disabled as well. Anybody any clue whether this is intentional or how to desl with this?

 

Steema Software support forums are publicly readable but only writeable to customers with active commercial subscriptions.

The contact form should work fine. If it doesn't, you can always write at "info at steema.com" or "sales at steema.com".

 

---

 

Yeray Alonso

Steema Software

Edited by Yeray
  • Like 1
  • Thanks 1

Share this post


Link to post

Thanks for all this information! Will ty it out as soon as I get back to this project after pentacoste!

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×