Recent

Author Topic: TChart's TBSplineSeries Pen Style Limited  (Read 696 times)

munair

  • Hero Member
  • *****
  • Posts: 862
  • compiler developer @SharpBASIC
    • SharpBASIC
TChart's TBSplineSeries Pen Style Limited
« on: April 09, 2025, 09:23:01 am »
On Linux GTK the TChart's TBSplineSeries seems limited to psSolid and psDot. I tried varies settings, like turning Cosmetic on/off, but psDash and psDashDot don't seem to work. Is this a known limitation?
It's only logical.

440bx

  • Hero Member
  • *****
  • Posts: 5315
Re: TChart's TBSplineSeries Pen Style Limited
« Reply #1 on: April 09, 2025, 11:22:25 am »
Welcome back...

Just curious, how's that compiler you were/are writing coming ?
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v4.0rc3) on Windows 7 SP1 64bit.

munair

  • Hero Member
  • *****
  • Posts: 862
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: TChart's TBSplineSeries Pen Style Limited
« Reply #2 on: April 09, 2025, 12:00:07 pm »
Welcome back...

Just curious, how's that compiler you were/are writing coming ?
It's patiently waiting for the day I have more time to resume coding. My work has kept me too busy. I've hardly been able to code in Pascal either.
It's only logical.

wp

  • Hero Member
  • *****
  • Posts: 12800
Re: TChart's TBSplineSeries Pen Style Limited
« Reply #3 on: April 09, 2025, 06:17:55 pm »
On Linux GTK [...]
You really mean GTK rather than GTK2 or GTK3? I don't have GTK at hand, therefore I tested GTK2/GTK3(and QT5/QT6). I have the impression that when drawing a segment of the PolyLine the stroke pattern begins always at "zero", in other words, it does not remember which part of the pattern has not been drawn for the previous segment and would be needed now for the current segment. Therefore, when the lengths of the patterns are too narrow, patterns could become undistinguishable.

The B-Spline series is a calculated series, and in principle could be calculated for every pixel. The property Step determines the distance of neighboring data points to be calculated. The length of the segments therefore, is Step pixels. And this length should be equal to the stroke period of the pen pattern. The default value is 4, and it is my impression that this is not enough the contain the period of the dash pattern. Increase the Step of the dashed BSplineSeries to 8 or 10, and the pattern should become nicer (maybe an even higher value is needed for dash-dot etc). But don't select a too-high Step value because the series then will not be displayed as a smooth curve any more.

The widgetsets seem to use different algorithms for drawing stroked lines. I have the impression that GTK2/GTK3 begin with the space part of the pattern because when Step is too small (1 or 2) no dashed/dotted curve is drawn at all. QT5/QT6, on the other hand, seem to begin with the stroke part, and here I always see a solid line when Step is too small.

In conclusion: When using stroked lines adjust the Step parameter of the series to the stroke-pattern. Basically this should apply to other calculated series (FuncSeries, CubicSpline)

munair

  • Hero Member
  • *****
  • Posts: 862
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: TChart's TBSplineSeries Pen Style Limited
« Reply #4 on: April 09, 2025, 08:39:02 pm »
Thanks for your explanation wp. Yes, it's GTK2/GTK3. Setting Steps to a higher value works partially. See image. Dashed works for the red peak at 13, but it fails at 14-15 where the horizontal line should also be dashed.
It's only logical.

wp

  • Hero Member
  • *****
  • Posts: 12800
Re: TChart's TBSplineSeries Pen Style Limited
« Reply #5 on: April 09, 2025, 11:08:27 pm »
Maybe the Steps are still too small?

Probably, the stroke procedure should be rewritten, accumulating the strokes and spaces painted from the start of the PolyLine.

munair

  • Hero Member
  • *****
  • Posts: 862
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: TChart's TBSplineSeries Pen Style Limited
« Reply #6 on: April 09, 2025, 11:56:06 pm »
I used step values from 4 to 21. See image. Horizontal lines remain inconsistent. TLineSeries is doing OK btw. It's an issue with TBSplineSeries.
« Last Edit: April 09, 2025, 11:58:18 pm by munair »
It's only logical.

wp

  • Hero Member
  • *****
  • Posts: 12800
Re: TChart's TBSplineSeries Pen Style Limited
« Reply #7 on: April 26, 2025, 11:07:54 am »
Probably, the stroke procedure should be rewritten, accumulating the strokes and spaces painted from the start of the PolyLine.
In the new TAChart version in Laz 4.99, the line-like series have a new pen type, TEnhancedChartPen, in which you can activate an alternative drawing method of stroked lines by setting the EnhancedBrokenLines property to true. In this mode the lengths of all strokes and spaces are accumulated since the time where EnhancedBrokenLines has been activated, and the strokes are drawn as simple solid lines. This way, this operation mode often results in an improved visual impression, in particular for TBSplineSeries.

munair

  • Hero Member
  • *****
  • Posts: 862
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: TChart's TBSplineSeries Pen Style Limited
« Reply #8 on: May 10, 2025, 09:09:59 am »
Thanks wp!
It's only logical.

 

TinyPortal © 2005-2018