Issue with TeeChart and changing field names
I found an issue that I wanted to let you know about. I created a report
with a TeeChart that pointed to a particular DBISAM table. Everything was
fine until I changed the field name. I assumed I could open the report and
just change instead I received an AV in unit ppChrtDB in method
TppCustomDBChart.RecordToPoint.
I was able to fix it by adding the following code (see part where it
contains SMP CODE):
procedure TppCustomDBChart.RecordToPoint(aDataPipeline: TppDataPipeline;
aSeries: TChartSeries);
var
liIndex: Integer;
liFieldCount: Integer;
lsFieldAlias: String;
lField: TppField;
lsXLabel: String;
lColor: TColor;
ldX: Double;
ldY: Double;
begin
ldX := 0;
ldY := 0;
lColor := clTeeColor;
{get the x-label}
if (aSeries.XLabelsSource <> '') then
begin
lsFieldAlias := aSeries.XLabelsSource;
lField := aDataPipeline.GetFieldForAlias(lsFieldAlias);
{ BEGIN SMP CODE }
if (lField = nil) then
lsXLabel := lsFieldAlias
else
lsXLabel := aDataPipeline.GetFieldAsString(lField.FieldName)
{ END SMP CODE }
end
else
lsXLabel := '';
Any way to fix this without changing your source? The rest of the method
appears to support if lField is nil.
Thanks.
SMP
with a TeeChart that pointed to a particular DBISAM table. Everything was
fine until I changed the field name. I assumed I could open the report and
just change instead I received an AV in unit ppChrtDB in method
TppCustomDBChart.RecordToPoint.
I was able to fix it by adding the following code (see part where it
contains SMP CODE):
procedure TppCustomDBChart.RecordToPoint(aDataPipeline: TppDataPipeline;
aSeries: TChartSeries);
var
liIndex: Integer;
liFieldCount: Integer;
lsFieldAlias: String;
lField: TppField;
lsXLabel: String;
lColor: TColor;
ldX: Double;
ldY: Double;
begin
ldX := 0;
ldY := 0;
lColor := clTeeColor;
{get the x-label}
if (aSeries.XLabelsSource <> '') then
begin
lsFieldAlias := aSeries.XLabelsSource;
lField := aDataPipeline.GetFieldForAlias(lsFieldAlias);
{ BEGIN SMP CODE }
if (lField = nil) then
lsXLabel := lsFieldAlias
else
lsXLabel := aDataPipeline.GetFieldAsString(lField.FieldName)
{ END SMP CODE }
end
else
lsXLabel := '';
Any way to fix this without changing your source? The rest of the method
appears to support if lField is nil.
Thanks.
SMP
This discussion has been closed.
Comments
Thanks for the info. I will research this and add the fix to the next
release.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com