Recent

Author Topic: Ticks pen width  (Read 2911 times)

prema

  • New Member
  • *
  • Posts: 14
Ticks pen width
« on: November 03, 2021, 06:24:20 pm »
Hi everyone,

I would like to adjust the thickness of the ticks on the axis, but I'm not able to find the way. The length is possible to adjust by the TickLength or TickInnerLength. But I didn't find the way how to increase the thickness. For example if I put the AxisPen.Width := 2; then thickness of the ticks stay with width 1 what doesn't look good.

I also tried to adjust directly Chart.Drawer.SetPenWidth, but withou success. From what property the width of the ticks is taken? Thanks for help.

With best regards

Premek

wp

  • Hero Member
  • *****
  • Posts: 9589
Re: Ticks pen width
« Reply #1 on: November 03, 2021, 06:46:00 pm »
No, whatever you do the tick penwidth is reset to 1 immediately before drawing the ticks. The only way to interfere would be to write a descendant of the drawer class and override its PrepareSimplePen method in which this happens. But this would have many sideeffects because this method is used at several places.

I think it's better to add a new property TickWidth. Should both kinds of ticks, inner and outer, have the same width?
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

prema

  • New Member
  • *
  • Posts: 14
Re: Ticks pen width
« Reply #2 on: November 04, 2021, 10:31:16 am »
Thank you for quick answer.

I think that all minor/major, inner/outer ticks can have the same width. On the other hand instead of having the new property, I think that the pen for ticks can be the same as the one for AxisPen. When I change the color or width of the axis the ticks go with it.

Thanks once more

Premek
« Last Edit: November 04, 2021, 10:35:09 am by prema »

wp

  • Hero Member
  • *****
  • Posts: 9589
Re: Ticks pen width
« Reply #3 on: November 04, 2021, 10:45:31 am »
Added a new property TickWidth (default 1) to major and minor axes. It is available in Laz/main (trunk); being a new feature it will not make it into the upcoming v2.2 shortly before its release.
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

prema

  • New Member
  • *
  • Posts: 14
Re: Ticks pen width
« Reply #4 on: November 04, 2021, 12:13:58 pm »
Good job. Thanks a lot. I will wait for it release.

For now I just did some workaround to put

FDrawer.SetPenWidth(FAxis.Grid.Width);

into the TAxisDrawHelper.DrawMark procedure just before to draw the ticks and labels. I don't use the grid, so I just use the grid pen width property to adjust the desired ticks pen.

Premek

 

TinyPortal © 2005-2018