Need help with Horizontal histogram!

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
edgemeistergeneral
Newbie
Newbie
Posts: 6
Joined: Thu Apr 24, 2008 12:00 am

Need help with Horizontal histogram!

Post by edgemeistergeneral » Fri May 09, 2008 3:48 pm

I've been using TeeChart successfully with line and bar charts however I'm having trouble with a horizontal Histogram.

I have a range or numbers, for example one hundred numbers between 1 and 5. In other words x number are 1, x number are 2, x number are 3 etc etc.

I need to plot the nmbers 1 - 5 on the Y axis and the number of occurences on the X and display horizontal bars displaying the number of occurences for each. Something like this

5 ||||||||||||
4 ||||||
3 |||||||||||||||||
2 ||||
1 ||||||||||||
0 5 10 15 20 25

I'm having trouble creating a series and adding it in such a way to produce the chart required. Any help would be much appreciated, many thanks.

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 May 12, 2008 8:10 am

Hi edgemeistergeneral,

To achieve what you request you need to populate horizontal series like this:

Code: Select all

			horizHistogram1.Add(25, 0);
			horizHistogram1.Add(13, 1);
			horizHistogram1.Add(23, 2);
			horizHistogram1.Add(19, 3);
			horizHistogram1.Add(3, 4);
			horizHistogram1.Add(6, 5);
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

edgemeistergeneral
Newbie
Newbie
Posts: 6
Joined: Thu Apr 24, 2008 12:00 am

Post by edgemeistergeneral » Mon May 12, 2008 3:18 pm

Many thanks, that worked a treat.

There is one small problem however that I can't seem to solve. The bottom and top horizontal lines of the series are half the size of the others. Is there a way I can set the thickness of the bars so they are all the same?

thanks

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 May 12, 2008 3:29 pm

Hi edgemeistergeneral,

Yes, you can either set axes min. and max. offset:

Code: Select all

			tChart1.Axes.Left.MaximumOffset = 30;
			tChart1.Axes.Left.MinimumOffset = 30;
or manually set left axis min. and max. values:

Code: Select all

			tChart1.Axes.Left.SetMinMax(horizHistogram1.MinYValue() - 1, horizHistogram1.MaxYValue() + 1);
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

edgemeistergeneral
Newbie
Newbie
Posts: 6
Joined: Thu Apr 24, 2008 12:00 am

Post by edgemeistergeneral » Mon May 12, 2008 3:37 pm

perfect, many thanks!

Post Reply