Problem Export with TSeriesDataText and NULL Values

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
viper
Newbie
Newbie
Posts: 16
Joined: Mon Apr 19, 2010 12:00 am

Problem Export with TSeriesDataText and NULL Values

Post by viper » Mon Feb 24, 2014 8:45 am

Hello

I'm exporting my data withe the method of TSeriesDataText. Follow my code:

PROCEDURE TfrmVis_Grafik.btnExportClick(Sender : TObject);
VAR
i : Integer;
SDT:TSeriesDataText;
BEGIN
IF (cbGrafik.Text <> '') THEN BEGIN
SaveDialog.FileName := CM.ExtractWord(1, cbGrafik.Text, [';'])+' '+FormatDateTime('yyyymmddhhnnss', Now);
IF SaveDialog.Execute THEN BEGIN
FOR i := 0 TO Chart .SeriesCount-1 DO BEGIN
IF Chart IS TLineSeries THEN BEGIN
Chart.Title := Titel[i+1];
END;
END;

Series11.ParentChart := NIL;
TRY
SDT:=TSeriesDataText.Create(Chart, NIL);
SDT.TextDelimiter := ';';
SDT.IncludeHeader := True;
SDT.SaveToFile(SaveDialog.FileName);
FINALLY
FreeAndNIL(SDT);
END;
Series11.ParentChart := Chart;
END;
END ELSE BEGIN
MessageDlg(SNoGraphicProfile, mtError, [mbOK], 0);
END;
END;

Everything are ok, but in my datas are some Values with "NULL" not "0"!! The Line are interrupted (see Snap4.jpg) correctly, but when i export the Lineseries, the "NULL" value are exportet with "0" (see Snap5.jpg), but i need a "blank" cell!!

May somebody can give me a hint, to solve my problem

Regards
Gregor
Attachments
snap.zip
(371.76 KiB) Downloaded 635 times

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Problem Export with TSeriesDataText and NULL Values

Post by Narcís » Mon Feb 24, 2014 1:13 pm

Hi Gregor,

Zero is the default null value when no other value is provided. You can change that using TChartSeries.DefaultNullValue property or just populate your series with values and set null points setting them to clNone color or using the SetNull method, for example:

Code: Select all

  Series1.AddXY(5, 5, clNone);
or

Code: Select all

  index:=Series1.AddXY(5, 5);
  Series1.SetNull(index);
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

viper
Newbie
Newbie
Posts: 16
Joined: Mon Apr 19, 2010 12:00 am

Re: Problem Export with TSeriesDataText and NULL Values

Post by viper » Tue Feb 25, 2014 6:59 am

Hello Narcis

Thanks for your fast answer, but i think tou didn't understand my question.

Because, i use the NULL Values to prevent to draw the line (see snap4.jpg). Everytime my PLC (Controller) are Offline i add a NULL Value to the cart (see snap5.jpg), to show the user that are no values saved at this time. The Line is drawed interrupted. This is working well, but when i export this values, my NULL Values are exported as a "0" value!! This is my problem! And i also think these are not correct!

Regards
Gregor
Attachments
Snap5.jpg
Snap5.jpg (115.49 KiB) Viewed 7611 times
Snap4.jpg
Snap4.jpg (111.15 KiB) Viewed 7611 times

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Problem Export with TSeriesDataText and NULL Values

Post by Yeray » Wed Feb 26, 2014 10:58 am

Hello,

All the points in TeeChart have a value, even if they are null. The null property is like a flag (it's actually clNone Color), independent than the value for that point.
This way you can choose to not to draw the null values, as you do, with tnDontPaint, but you can still draw them with tnIgnore, if you want.

The value a null point has depends on ho you've entered the point. If you use the AddNull method, the point entered will have the DefaultNullValue value. If you use SetNull method, the value for that point isn't changed, only the Color.

I can think on two ways to know what points are the null points in your exported file:
- You can to export the series with IncludeColors=true so the colors can be also exported and you can know what values were null points.
- You can set a particular value when adding/setting your null values. A value that you know that can unequivocally identify your null points. A value that you are sure you won't find in the series.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

viper
Newbie
Newbie
Posts: 16
Joined: Mon Apr 19, 2010 12:00 am

Re: Problem Export with TSeriesDataText and NULL Values

Post by viper » Thu Feb 27, 2014 3:22 pm

Hello Yeray

Thanks for you hints.

Best Regards
Gregor

Post Reply