CurrRecno not visible for ChartType = 5

Topics: General
Oct 30, 2009 at 1:24 PM

Hello,

I am trying to create a chart (line chart) and I want to display a custom value above each node. the method I tried works for bar charts, but not for line ones.

 

.ShowValuesOnShapes = .T.

.ShapeLegendExpression ="ThisForm.GenValueText(This.CurrRecno, lcField)")

 

and the GenValueText method is:

LPARAMETERS lnIndex, lcFieldName

SELECT crsChrtData

GOTO RECORD lnIndex IN crsChrtData

RETURN  TRANSFORM(crsChrtData.&lcFieldName.)

 

When using this code to generate a line chart, an error occurs in the _beforedraw method (line 225). What could I do?

 

Thank you very much.

 

LPARAMETERS lnIndex, lcFieldName
SELECT crsChrtData
GOTO RECORD lnIndex IN crsChrtData
RETURN ALLTRIM(ThisForm.cToolTipPrefix) + CHR(13) + CHR(10) + TRANSFORM(crsChrtData.&lcFieldName.)

 

 

 

 

Coordinator
Oct 30, 2009 at 1:32 PM

First of all, let me suggest you set the property Debug to .T.   This will at least save some error information to the file 'FoxCharts.Log' and also prompt you with some error information.

Now -- what is 'lcField'?   That is not a documented property in FoxCharts.  Without knowing anything else, I would suspect that is the culprit.

Jim Nelson

Oct 30, 2009 at 5:59 PM

Hello Jim,

The GenValueText method is a method written by myself in order to generate the text for the tooltips and the one to be displayed above each point on the chart. 

lnIndex - the recno() in the table source of the chart (crsChrtData)

lcFieldName - the name of the field in the crsChrtData table which contains the data to be displayed (in this case it is the same field used for the FieldAxis2 property).

lcField (from the calling code) is a variable which holds the field name used for the FieldAxis2.

I've set the Debug property to .T., but no file was created. The error message displayed on the screen also shows the error code (2071) and the message (User thrown error).

Thank you.

Lucian Ilea

Coordinator
Oct 30, 2009 at 8:02 PM

Lucian --

Your method should not rely on any local variables that happen to be available in the method that calls it.  You should write your method as if that calling method was hidden from your view.

Thus, you should only be referencing the CURR? Properties mentioned in the documentation.

If you wish to have the name of the field from your cursor,  you can use:

               This.Fields(This.CurrColumn).FieldValue

(Should the documentation ever be updated, I'm sure that this would be a valuable piece of information to include)

 

Jim

 

Coordinator
Oct 30, 2009 at 9:44 PM

Lucien --

By the way -- if you got a messagebox with error info in it, it appears that a file named 'FoxCharts.Log' gets created -- altho, for the life of me, I can't find where.

More on this on I find out where it went.

Jim

 

Oct 30, 2009 at 9:47 PM

The FieldValue returns another table field that the one I need. So, removed the parameters, and my method looks this way:

 

 

LOCAL lcText, lcFieldName
GOTO This.oChart.CurrRecno IN crsChrtData
lcFieldName = 'myfield'
lcText = 'Date: ' + TRANSFORM(crsChrtData.&lcFieldName.) + ;
CHR(13) + CHR(10) + 'Value: ' + TRANSFORM(This.oChart.CurrValue
RETURN lcText

LOCAL lcText, lcFieldName

GOTO This.oChart.CurrRecno IN crsChrtData

lcFieldName = 'myfield'  

lcText = TRANSFORM(crsChrtData.&lcFieldName.)

RETURN lcText

 

This way it is ok. Thank you for your help!

 

I would have another question if I may... In a line chart, when I have 0 values, and ShowValuesOnShapes=.T., the values are not displayed. Why is that? All values, except 0 are displayed correctly.

Thank you again.

All best,

Lucian

 

Oct 30, 2009 at 9:50 PM

The log file is created. My mistake was that I was setting Debug = .T. at design time, and in code I had Debug = .F. Now the FoxCharts.log file gets created in the current directory.

Thank you again

Coordinator
Oct 30, 2009 at 11:40 PM

Lucien --

No idea at all why zero values do not show values.  Sorry I can't help with that one.

Jim

 

Developer
Oct 31, 2009 at 4:28 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Developer
Oct 31, 2009 at 4:31 AM
jimrnelson wrote:

No idea at all why zero values do not show values.  Sorry I can't help with that one.

 Fixed in version 1.19J just uploaded.

Please test !

Oct 31, 2009 at 9:14 AM

Thank you very much! 

And thank you for this great tool. It helps me a lot. 

All best,

Lucian