Recent

Author Topic: [solve] Series is not assigned - why not?!  (Read 923 times)

Nicole

  • Hero Member
  • *****
  • Posts: 972
[solve] Series is not assigned - why not?!
« on: November 04, 2022, 03:09:04 pm »
I created a TAChart as before at design-time.
Added a series as before at desing-time.
Adding values to this series as usual at design-time.

at runtime:
series1.AddXY(100,200,'test');   

and get:

Exception-Klasse »External: ACCESS VIOLATIONg:
Access violation reading from address $00000000000000E8.
 In Datei 'tacustomseries.pas' in Zeile 978:
if Assigned(FSource) then

A check shows me, that series1 is nil.

How and why that?
I am new at TAChart, but have a handful of charts drawn fine in the meanwhile.
Always the series were created with the form and even in this form there is a chart, which is created fine.

Why may this series be nil at runtime?


« Last Edit: November 04, 2022, 07:14:08 pm by Nicole »

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: Series is not assigned - why not?!
« Reply #1 on: November 04, 2022, 03:39:00 pm »
I don't understand your text: You say you are adding values to the series at design-time, and then you show code for runtime? So what?

Did you change the series' name? If not then you should be aware that "Series1" is the name which Delphi gives to design-time created series. But TAChart puts the name of the chart and the type of the series to the front of it: "Chart1LineSeries1". Which name is shown in the object inspector for the series (look at the object tree above the property grid)?

Nicole

  • Hero Member
  • *****
  • Posts: 972
[solved] Re: Series is not assigned - why not?!
« Reply #2 on: November 04, 2022, 04:29:44 pm »
I added the series at design-time and populate them at runtime.

but...
Dear me, - how can this happen!?

And you solved it again by making me look into the object inspector: I used a wrong series name.
The next question would be: How that?
I used
self.
and then I waited for the editor to give me the right name.
It gave me the wrong name.

I had such problems in the past, that name / favorites tab / internal help are not sync by the name. I write it on one place and it was not corrected in the other field.
The "wrong" name, which led to the access violation was rather an old name. I used it for a chart, which I had deleted already. Lazarus seems to "have this in mind", when the text completion offered me this. And the compiler seems to "think", this is all ok?!

Is there anywhere a kind of cache I can delete? In Delphi I deleted the *.dcu files in such cases. Or I used "erzeugen" to clean up internal stuff.

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: [solved] Re: Series is not assigned - why not?!
« Reply #3 on: November 04, 2022, 04:49:12 pm »
The next question would be: How that?
I used
self.
and then I waited for the editor to give me the right name.
It gave me the wrong name.
If you had declared "Series1: TLineSeries" in addition to the automatically generated name ("Chart1LineSeries1") this method will show you both. But the list is alpha-sorted, and "Chart1LineSeries1" should be near the top while "Series1" should be near the end. So, I don't know...

In Delphi I deleted the *.dcu files in such cases. Or I used "erzeugen" to clean up internal stuff.
"Run" > "Build" is the same as "erzeugen". Try this. Or, even more effective, "Run" > "Clean up and Build". But the IDE has a long memory sometimes... Therefore, when I get the feeling that it still uses something which should not be there any more, I simply close and restart it.

Nicole

  • Hero Member
  • *****
  • Posts: 972
Re: [solve] Series is not assigned - why not?!
« Reply #4 on: November 04, 2022, 07:22:29 pm »
I do all this quite frequently, so "it is still there".

About my working: I select "add a new series" at design-time with the object inspector being open. There I change the name at sudden. There "should not" be such a thing, alike 2 names.

You remember my question about the checkbox for selecting series to display? It never worked, no matter what I tried. So I deleted the old chart from the form and made a new chart from scratch. These access violations .... were the old-series names, which I wrote by mistake as typo and which were accepted by the compiler. Something deep in the IDE went wrong.

Maybe the same ghost which did make the mess in the ChartListBox-order, which shouts now the old names...

The good news are: The old series are really dead and the new ones show up as they should in the Chartlistbox.

 

TinyPortal © 2005-2018