79707390

Date: 2025-07-19 16:19:31
Score: 1
Natty:
Report link

The Yeray's solution above is good enough for a bar chart but not suitable for a line chart where working series (lines) might have zero value.

In that case, when using OnAfterDraw, the working line series are hidden by the customdrawn horizontal line.

In my case I actually needed a solution for a line chart. For this, the best solution seems to be to use the OnBeforeDrawSeries event instead. The remaining code is the same.

If anyone uses the TaChart component in Lazarus instead of TeeChart in Delphi, the approach there is similar. But because OnBeforeDrawSeries event is missing in TaChart, OnAfterCustomDrawBackWall appears to be the best to do the job.

Another possible solution which I've found myself in the meantime is to use a dummy zero line series.

Another solutions specific for TaChart might be available in the Lazarus forum where I asked the same question:
TAChart how to make different width and/or color only for a specific grid line

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: tk_