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

TeeChart for ActiveX, COM and ASP
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 Jan 04, 2008 11:12 am

Hi Frances,

Thanks for the information.
Now I am okey to draw line series using TeeChart . but I am not able to understanding how I will draw Histogram using TeeChart .

I am having four coordinates i.e left , right , top , bottom to draw histogram but I don't know which are the methods or properties required to draw histogram series. also I don't know how to fill color in histogram series.

So could you please send me some sample code for MS VC++ technology which contains example to draw histogram series using Teechart activeX .
Ok, you can create and populate histogram series like this:

Code: Select all

	long series1;	
	series1 = m_Chart1.AddSeries(scHistogram);
	
	m_Chart1.Series(series1).SetColor(RGB(255,0,0));

	for	(int i=0; i<10; i++)
	{
		m_Chart1.Series(series1).AddXY(i,i,"",clTeeColor);
	}
You had suggested me to use following,

For further information about VC++ applications with TeeChart please read Tutorial 15 - MS VC++ Applications and have a look at the examples at C:\Program Files\Steema Software\TeeChart Pro v8 ActiveX Control\Examples\Visual C++. I also recommend you to have a look at Tutorial 7 - Working with Functions

but I don't have these materials on my machine .
As I told you before, to obtain full documentation and examples you need to download the full TeeChart Pro v5 ActiveX installer at our customer download area.
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

Frances
Newbie
Newbie
Posts: 39
Joined: Fri Oct 19, 2007 12:00 am
Location: Netherlands

Post by Frances » Mon Jan 07, 2008 4:02 am

Thanks,

But I am not able to find TeeChart Pro v5 ActiveX installer from customer download area?

Could you please help me to download TeeChart Pro v5 ActiveX installer?

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 Jan 07, 2008 9:28 am

Hi Frances,

Would you be so kind to contact our Sales Dept. at sales@steema.com? Provide them with your customer and license number so that they can identify and check your license in our records.

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

Frances
Newbie
Newbie
Posts: 39
Joined: Fri Oct 19, 2007 12:00 am
Location: Netherlands

Post by Frances » Mon Jan 07, 2008 10:13 am

Thanks , I will do that.....

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

Post by Abhijit » Tue Jan 08, 2008 12:10 pm

I am trying to draw histogram using TeeChart proActiveX v5. Following function I am using to draw histogram , but somehow AddXY funtion is not working properly.

void CSfxStatisticsView::DrawRect(double dLeft, double dTop, double dRight, double dBottom, int iLineWeight, COLORREF lineColor, COLORREF fillColor)
{
SeriesInfo_t* pInfo = NULL;
if (m_SeriesMap.Lookup(-1, pInfo))
{

pInfo->pHistogramSeries->AddXY(dLeft, dBottom,"",(OLE_COLOR)lineColor);
pInfo->pHistogramSeries->AddXY(dLeft, dTop,"",(OLE_COLOR)lineColor);
pInfo->pHistogramSeries->AddXY(dRight, dTop,"",(OLE_COLOR)lineColor);
pInfo->pHistogramSeries->AddXY(dRight, dBottom,"",(OLE_COLOR)lineColor);
pInfo->pHistogramSeries->AddXY(dLeft, dBottom,"",(OLE_COLOR)lineColor);

}

}



Please let me know is this correct code to draw histogram and to fill color in each bar ?

Also please let me know which are the properties need to set while drawing histogram.

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 » Tue Jan 08, 2008 2:32 pm

Hi Abhijit,

You'd better populate histogram series in the dialog initialization code. Then, instead of providing left, top, right and bottom you should only use X and Y values for where you want each bar being drawn (x value) and the value each bar should have (y value) TeeChart will automatically draw the polygons using this information.

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 Jan 09, 2008 6:46 am

Do you have any histogram sample MS VC++ code which is used to draw the polygons .


Thanks for your information

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 Jan 09, 2008 9:15 am

Hi Abhijit,

Have you tried using the code example I posted on this thread on 4th January?

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 » Wed Jan 09, 2008 10:05 am

I have tried but didn't get any luck to draw histogram series. Can you please brief explain how that histogram works .. which are the properties we need to set to draw histogram ....

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 Jan 09, 2008 11:31 am

Hi Abhijit,

Using the code I posted should be enough. Do you receive any specific error message?

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 » Wed Jan 09, 2008 11:35 am

I din't get any error message , but I think I am missing certain properties to set . So because of that only I am asking if you have any list of properties need to set while drawing histogram series could you please send it to me?

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 Jan 09, 2008 11:56 am

Hi Abhijit,

Could you please try modifying one of the examples at C:\Program Files\Steema Software\TeeChart Pro v8 ActiveX Control\Examples\Visual C++ with the code I sent and check if it works fine at your end?

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 » Thu Jan 10, 2008 5:14 am

Thank you now I am able to draw Histogram....

Happy New Year

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

Post by Narcís » Thu Jan 10, 2008 8:48 am

Hi Abhijit,

You're welcome, I'm glad to hear that.

Thank you very much. I wish you the best for 2008 as well.
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 » Thu Jan 10, 2008 9:27 am

Thanks , Last problem .. Is it necessary to set width of the Polygon while drawing histogram? if not what default value did it takes?

How that width is calculated?

Post Reply