0

When plotting a line series in which some values have their ValueColor set to clNone, the line will display as if those points didn't exist or were invisible.

However, when I use the TCrossFunction against that same line series, it behaves as if those points were visible.

The first image shows the crosspoints indicated by the orange 'X' symbols when the ValueColor of the point between them is NOT clNone.

enter image description here

This image shows the crosspoints are still in the same location, even though the point between them has had its ValueColor property set to clNone.

enter image description here

BTW, I did call CheckDataSource to refresh the crosspoints before plotting.

How do I get the crosspoints function to respect the ValueColor property?

TLama
  • 75,147
  • 17
  • 214
  • 392
SteveB
  • 91
  • 1
  • 4

1 Answers1

2

Looks like the easiest and fastest solution, for my purposes, is to filter out null points (ValueColor = clNone) before subjecting them to the CrossPoints function.

Something like this works for me:

function create_non_null_series (series: TChartSeries): TChartSeries;
var
    i: Integer;
begin
    Result := TChartSeries.Create(nil);
    for i := 0 to series.Count-1 do
    begin
        if (not series.IsNull(i)) then
            Result.AddXY(series.XValue[i], series.YValue[i]);
    end;
end;

There's probably something built in to TChart that does this, but I haven't found it.

SteveB
  • 91
  • 1
  • 4
  • I'm afraid the TCrossPointsFunction doesn't consider the null points in its sources. I've added it to the wish list to be considered for inclusion in future releases (TV52016496). In the meanwhile, the workaround you found sounds to me as the way to go. – Yeray Jan 30 '13 at 08:43
  • To make things more confusing, the TCrossPointsFunction class has an 'IgnoreNulls' property, but it doesn't seem to affect anything, at least as far as I could tell. – SteveB Jan 30 '13 at 20:44
  • TCrossPointsFunction inherits from TTeeFunction, who has an IncludeNulls property. – Yeray Jan 31 '13 at 08:06