The posted program works fine here (Win7, Laz-trunk/FPC2.6.4, or Laz1.2.6/FPC2.6.4) after initializing the variable "IsVertical" (as noted above)
procedure TForm1.AddverticallineSeries(axaxesnr:integer);
var
series: TconstantLine;
Isvertical:Tlinestyle;
begin
IsVertical := lsVertical; // <---- is missing
series := TconstantLine.Create(self); //
series.linestyle:= IsVertical;
series.position:=axaxesnr;
series.SeriesColor := clred;
chart1.addseries(series);
end;
But the direct assignment (series.linestyle := lsVertical) is working also.
You did not post the lpi file (I did tell you to post pas, lfm, lpi and lpr files...), therefore I can't tell if the TAChart package is properly added, but I think so because this happens automatically when you click a TChart into the form.
I attach an adapted version of your program which is complete - no changes, just making sure that the package is included and some cosmetic changes in indentation (I can't read unindented source code...). Unzip the contents to some folder, compile and run. It definitely works!
If the program will not work properly my explanation would be you could have a corrupted Lazarus and/or TAChart installation or user profile.
Maybe the first thing to do would be to recompile the TAChart package: Select "Package" / "Open package (.lpk)", navigate to "(lazarus-folder)\components\tachart" and select the file "tachartlazarus.pkg". Compile.
If this does not help recompile Lazarus: Select "Tools" / "Build Lazarus with profile...". This takes some time, at the end Lazarus will be restarted in the newly compiled version.
If this does not help either reset your user profile: In the Windows explorer (I assume you use Windows - you did not answer my question regarding the operating system...) navigate to c:\users\<your name>\AppData\Local\. Seek the folder "Lazarus". Rename it and run Lazarus again. This resets all user settings to their default values. If this solves your issue you have to reinstall all your components.
If not the final option is to reinstall Lazarus. Delete the old installation folder. Download the current version and install.
If this does not help I have no more idea...