Page 1 of 1

To format money values+legends+regional options (local) ???

Posted: Thu Jan 26, 2006 9:34 am
by 9524207
Hello,

To format money values in the legends by respecting the formatting of the regional options ?

Starting from a page ASP and vbScript how to force TChart (V7.0) so that it formate in the legends of the money values by respecting the parameters of regional options of Windows?

US format : 1,000,000.00
French format : 1 000 000,00

I tried to pass the values by using the vbScript instruction formatnumber () :

Example:


xValue = 1000000
xLib = "my value"
xColor = RGB (71,250,52)

Set Chart = CreateObject ("TeeChart.TChart")

Chart .AddSeries (X)

Chart.Series (0) .Add formatnumber (xValue, 2), xLib, xColor


but does that cause a TChart error!? TChart does not seem by supporting the preformatting of the values.
There is well a Legend.TextStyle property but it is impossible to act on the presentation of the values themselves by respecting the configured options of the regional parameters!!!

You could indicate the procedure to be followed to me to force TChart to use the regional parameters.

Cordially,

Posted: Thu Jan 26, 2006 9:59 am
by narcis
Hello,

Have you tried using OnGetLegendText event and use its LabelText string paramter and format it?

Posted: Thu Jan 26, 2006 10:11 am
by 9524207
I found the property .ValueFormat but that does not seem to function???
...

xValue = 1000000
xLib = "my been worth"
xColor = RGB (71,250,52)

Set Chart = CreateObject ("TeeChart.TChart")

Chart.AddSeries (X)

Chart.Series (0) .Add xValue, xLib, xColor
Chart.Series (0) .ValueFormat = "#,##0.00"

But does that always cause a TChart error !? :cry: Is there another thing to add so that that can function ?

Cordially,

Posted: Thu Jan 26, 2006 10:26 am
by 9524207
Hello Narcís !

Sorry but the OnGetLegendText event is usable only in VB not in vbScript in a ASP page as that is indicated in the help file of TChart:

Private Sub TChart1_OnGetLegendText (ByVal LegendStyle Have Long, ByVal ValueIndex Have Long, LegendText Have String)

....

...

End Sub
How do you make to use it in a ASP page ???

Cordially,

Posted: Mon Jan 30, 2006 7:56 am
by Pep
Hi,

the events of all ActiveX Controls cannot be called from an ASP page run
server-side as you've seen . If you wish to change the text of the legend then you will have to either:
1. Place a TeeChart object on the client-side browser and run OnGetLegendText() the event client-side.
2. House the TeeChart object in a VB UserControl and run OnGetLegendText() from there - there is an example of this in the ASP examples called "Why script in ASP?"