Need sample code to draw Histogram Series in VC++ (MFC)

TeeChart for ActiveX, COM and ASP
Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed Feb 06, 2008 12:23 pm

Hi Abhijit,

sorry for delay !
We've been looking at the files you sent to us, and we're very sorry but we don't understand so far where the problem is.

In order to sort it out, would you be so kind to send me two simple images (one with the Chart you're trying to accomplish and other with the resulted Chart you're getting).

Looking at some of your posts I've seen you're trying to change the automatic axis scale. If so, let you know it (either automatic or custom) can be customized at your own. To set it off you need to set automatic to false :

TChart1.getAxis().getLeft().setAutomatic(False);

Then you will have to set a min and max value :
TChart1.getAxis().getLeft().SetMinMax (0, TChart1.getSeries(0).getYValues().getMaximum());

And then the desired increment :
TChart1.getAxis().getLeft().setIncrement(10);

If you only want to not be automatically calculated the min value for an axis you only have to use :

tchart1.geAxis().getLeft().setAutomaticMinimum(False);

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

Post by Abhijit » Thu Feb 07, 2008 4:10 am

Hi ,

If you closely look snapshot , that I have sent to you, you can find in second histogram chart view .. I am getting only lines of walls (without color)in histogram series ... If you could figure out this case why I am getting only lines without color this will be very helpful for me...because to plot histogram series AddXY function takes last parameter i.e color .. so the wall should be paint with that color.

According to my investigation I am giving accurate data to AddXY function i.e X and Y values to this TeeChart function .. So why for the first 10 values this AddXY function able to plot walls with color... and for the other next values I am getting only lines of wall without color....


e.g

My X scale varies from 0.0 to 1.0 and each interval increment with 0.1..
i.e X scale is 0.0 , 0.1,0.2,............1.0..

So in AddXY function to plot histogram I am passing X values start from 0.0 and end with 1.0.. And Y values is height of histogram

suppose my Xscale sets setMinMax(0,1) and Y scale sets to
setMinMax(-1,1)...

Now DrawHistogramValue function call from OnBeforeDrawSeries() TeeChart event..

This fucntion contains for() loop in that I am calling AddXY function that loop will continue for first 10 values of X scale i.e first value of X is 0.0 , 2nd is 0.1,3rd is 0.3 and so on up to 0.9... and Y value should be height..

While executing this loop if we get Y values range between Y scale i.e (-1,1) ... AddXY will plot wall for that ...


I would like to appriciate if you could try to figure out why I am getting only lines ?

I am desperately waiting for your positiive response ... Could you please let me know your contact deatils so I am reach you in case of you need my help...

If you clould prepare one simple example for only histogram seriers like my application and send it to me , I think this will also helpful for me ... from you samples examples it is not possible to figure out exact problem ..
Regards
Abhijit Nimbalkar

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Thu Feb 07, 2008 12:15 pm

Hi Abhijit,

ok, now I know what you mean, but I've not been able to reproduce the problem here, using the example you sent us (Pramod), nor with a new one created here.

The example (Pramod) you sent us is a little different from the sample images you sent. However, seeing at your code, I do not understand why you are adding the data into the OnBeforeDrawSeries event. This means that every time the Series are going to be drawn the points will be added again. So, maybe it'd be better to add them after the Series have been created.
Another strange thing is the use of custom axes, what are they used for ? As you only make use of the bottom and left axis, you don't need to create the custom ones.

I've posted a project I've created with VC++6 and converted to VC.NET at http://www.steema.com/files/public/supp ... Sample.zip, it works fine here (it draws all the points with its bar color correctly). Could you please check it, and if it's required modify it so I can reproduce the problem here ?

If that's the case, please send me the example directly to pep@steema.com

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

Post by Abhijit » Wed Feb 13, 2008 5:54 am

Hi ,

I have sent my sample progem on this 'pep@steema.com' mail id on friday . But I didn't receive any response . Could you please let me know the status ? Have you figure out this problem?

Thanks in advance...

regards
Abhijit

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

Post by Abhijit » Thu Feb 14, 2008 3:32 am

Hi pep,

I have sent one query to your account i.e pep@steema.com could you please reply onto that?

Regards
Abhijit

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

Post by Abhijit » Fri Feb 15, 2008 10:43 am

Hi Pep,
First of all Thanks for all your help,

Could you please answer my last few question, that I have sent it on you pep account

regards
Abhijit

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

Post by Abhijit » Fri Feb 15, 2008 12:25 pm

Hi Pep,

Could you please see my modified files and run and see the problem that I have explained in my mail and sent it on your account.

Thanks in Advance

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 Feb 18, 2008 5:09 pm

Hi Abhijit,

We have received your files. We are currently investigating the issue and will 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

Post Reply