Page 1 of 1

Problem Export with TSeriesDataText and NULL Values

Posted: Mon Feb 24, 2014 8:45 am
by 16555944
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

Re: Problem Export with TSeriesDataText and NULL Values

Posted: Mon Feb 24, 2014 1:13 pm
by narcis
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);

Re: Problem Export with TSeriesDataText and NULL Values

Posted: Tue Feb 25, 2014 6:59 am
by 16555944
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

Re: Problem Export with TSeriesDataText and NULL Values

Posted: Wed Feb 26, 2014 10:58 am
by yeray
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.

Re: Problem Export with TSeriesDataText and NULL Values

Posted: Thu Feb 27, 2014 3:22 pm
by 16555944
Hello Yeray

Thanks for you hints.

Best Regards
Gregor