Axis ValueFormat

TeeChart for ActiveX, COM and ASP
Abhijit
Newbie
Newbie
Posts: 44
Joined: Fri Nov 15, 2002 12:00 am

Post by Abhijit » Tue Mar 25, 2008 8:40 am

Hi ,
I am using TeeChart5.0 control

To set values on the Y Axis I am using SetMinMax() TeeChart function which takes 2 parameter MinY and MaxY ...

suppose,

MinY = 0.099999904632568359
MaxY = 0.10000002384185791

So while plotting these values on the actual graph . this SetMinMax() rounds these values so it becomes MinY = 0.1 and MaxY = 0.1

so all the values on Y Axis I am getting as 0.1.

----------------------------------------------------
I want to increase the decimal places on the Y-Axis when displaying it on to control... So I will get following values on the graph

e.g

MinY = 0.09999990
MaxY = 0.10000002

So could you please let me know how I will achieve this?

Regards
Abhijit Nimbalkar

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Mar 25, 2008 11:47 am

Hi Abhijit,

You can use something like this:

Code: Select all

    TChart1.Axis.Bottom.Labels.ValueFormat = "0.00000000,#########"
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Abhijit
Newbie
Newbie
Posts: 44
Joined: Fri Nov 15, 2002 12:00 am

Post by Abhijit » Fri Apr 04, 2008 8:39 am

Hi ,
I am using TeeChart 5 control to draw the line series ..

I am plotting line series . On the Y axis I am having some decimals,

According to your suggestion I have set the Value format for Y Axis label i.e
TChart1.Axis.Bottom.Labels.ValueFormat = "0.#########"

OutPut that I am getting is

case 1:

0.10000002 - Max Y
0.1
0.09999998
0.09999996
0.09999994
0.09999992 - Min Y


I don’t want the 0.1 , I want it should be 0.100000000 in this case ....


But for above case I am ok with above set value format,

Input(wihthout setting value format)

case 2:

0.10000000 Max Y
0.09998000 0.09996000
0.09994000
0.09992000 - Min Y


exepected out put with the 0.######## value format that I want for above input

0.10000 Max Y
0.99998
0.09996 0.09994
0.09992 Min Y



All labels visible at the same time should have the same precision and only the number of decimals as applicable.

I want to reduce amount of decimal places automatically if the last decimal digits containing 0's in all the values on Y axis(i.e last zero should contain in the all the values in the Min and Max range) those 0's I want to supress .

I think the current valueFormat that I am using is right i.e(0.########),
but in only case -1 is exception for that , but in case -2 that format is right . Could you please let me know how I will achieve both the cases.

Regards
Abhijit

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Apr 04, 2008 10:11 am

Hi Abhijit,

Using the ValueFormat I suggested before works fine for me here:

Code: Select all

    TChart1.Axis.Bottom.Labels.ValueFormat = "0.00000000,#########"
Could you please test if it works fine at your end?

We would also appreciate if you started a new topic for your new questions as this thread has already gone off it's initial subject and discussions become more difficult to follow.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Abhijit
Newbie
Newbie
Posts: 44
Joined: Fri Nov 15, 2002 12:00 am

Post by Abhijit » Mon Apr 07, 2008 4:00 am

Hi ,

I have tried but this solution is not suitable to my problem.Could you please let me know whether u understood my problem.

If not let me know I will open new thread for my new questions...

Or could you please mail me at

a.nimbalkar@fugro.in , so I can send you some images to your mail account so you will easily understand my problem...

Regards
Abhijit Nimbalkar

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Apr 07, 2008 7:29 am

Hi Abhijit,

I thought I had understood your problem but it seems I hadn't.

It would be great if you could send us a simple example project we can run "as-is" at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Also please notice that we don't provide direct e-mail support except for Pro-Support subscribers.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Apr 07, 2008 8:41 am

Hi Abhijit,

I have read the e-mail you sent to Pep. In that case I recommand you to read how to set format strings here:

http://www.freepascal.org/docs-html/rtl ... float.html

Since TeeChart Pro ActiveX is a COM wrapper of TeeChart Pro VCL you need to check Object Pascal (Delphi) documentation.

Microsoft's equivalents are here:

http://msdn2.microsoft.com/en-us/library/0c899ak8.aspx

Hope this helps!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Abhijit
Newbie
Newbie
Posts: 44
Joined: Fri Nov 15, 2002 12:00 am

Post by Abhijit » Wed Apr 09, 2008 10:44 am

Hi ,

Thanks for your help.

But this is not sufficient .. I am not able to resolve my problem ..


If I pass follwing values ,

SetMinMax(0.9999998 , 1.0000000)

To set values on the Y Axis .... the values that I am getting on Y Axis is
1.0 every where.. because SetMinMax internally round above given values.

I don't want SetMinMax() rounds those values . how I will achieve that .. one method I know is that set ValueFormat property .. Could you please let me know any alternative solution?

Regards
Abhijit Nimbalkar

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Apr 09, 2008 11:27 am

Hi Abhijit,

Could you please confirm that you are setting labels ValueFormat exactly like this?

Code: Select all

    TChart1.Axis.Bottom.Labels.ValueFormat = "0.00000000,#########"
If this doesn't help please send us a simple example project we can run "as-is" to reproduce the problem here.

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Abhijit
Newbie
Newbie
Posts: 44
Joined: Fri Nov 15, 2002 12:00 am

Post by Abhijit » Fri Apr 11, 2008 6:27 am

Hi,
I have uploaded HistogramSamples.zip on your server . In that I am able to reproduce my problem.

Please take a look in HistogramSampleDlg.cpp...

In that I set values for Left Axis as

m_chart.GetAxis().GetLeft().SetMinMax(0.09999998 , 0.10000002);

But on the Axis if you run this application you can see 0.1 every where...

I want values should be display as following,

0.09999998
0.09999999
0.10000000
0.10000002


For this I have used the your ValueFormat property...
ValueFormat = "0.########"
But there is problem while setting this property ... I will get the Values on left Axis


0.09999998
0.09999999
0.1
0.10000002

because all the zero's will supress .....
I don't like 0.1 ..

second case :

If I used ValueFormat = "0.00000000"

Consider values is like this...

0.09996000
0.09997000
0.09998000
0.09999000
0.10000000

I don't want all the trailing zeros should be display...

I want output should be ..

0.09996
0.09997
0.09998
0.09999
0.10000


All labels visible at the same time should have the same precision and only the number of decimals as applicable...

Note : Values can not be in the same range .. it may vary ...
Regards
Abhijit

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Apr 11, 2008 10:24 am

Hi Abhijit,

First of all please notice that splitted the original topic in two for topic coherence.

Regarding the example project, where have you sent it? I can't find it neither at news://www.steema.net/steema.public.attachments newsgroup nor at our upload page.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Apr 11, 2008 10:26 am

Hi Abhijit,

Coincidentally Pep just forwarded me your example :wink:.

I'll look at it and get back to you ASAP.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Apr 11, 2008 10:29 am

Hi Abhijit,

I'm not able to uncompress the example package as it asks for a password. Would you be so kind to let us know the password we should use?

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Abhijit
Newbie
Newbie
Posts: 44
Joined: Fri Nov 15, 2002 12:00 am

Post by Abhijit » Fri Apr 11, 2008 12:01 pm

Sorry passowrd is,
zip

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Apr 11, 2008 2:01 pm

Hi Abhijit,

Thanks for the information.

Setting ValueFormat as I suggested (see code snippet below) works fine for me here as you can see in the image.

Code: Select all

void CHistogramSampleDlg::OnBeforeDrawAxesTChart()
{
	m_chart.GetAxis().GetBottom().SetStartPosition(0);
	m_chart.GetAxis().GetBottom().SetEndPosition(100);
	m_chart.GetAxis().GetBottom().SetPositionPercent(0);
	m_chart.GetAxis().GetLeft().SetStartPosition(0);
	m_chart.GetAxis().GetLeft().SetEndPosition(100);
	m_chart.GetAxis().GetLeft().SetPositionPercent(0);
	m_chart.GetAxis().GetBottom().SetMinMax(0,1);
	m_chart.GetAxis().GetBottom().SetIncrement(0.25);
	m_chart.GetAxis().GetLeft().SetMinMax(0.09999998 , 0.10000002);
	//m_chart.GetAxis().GetLeft().GetLabels().SetValueFormat("0.########");
	m_chart.GetAxis().GetLeft().GetLabels().SetValueFormat("0.00000000,########");
	//m_chart.GetAxis().GetLeft().SetIncrement(0.10000002 - 0.09999998 /2);
}
Image

You need to set ValueFormat using Custom Numeric Format Strings
I don't want all the trailing zeros should be display...
You'll have to choose an arbitrary number of digits as you do for label 0.10000
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply