Histogram plotting

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
amol
Advanced
Posts: 226
Joined: Tue Mar 29, 2005 5:00 am

Histogram plotting

Post by amol » Thu Jun 07, 2018 12:31 pm

Hi Steema Support,

I have a problem in plotting data in histogram plot.
Currently i have plotted it with dummy data as shown in image.
histogram.jpg
histogram
histogram.jpg (321.45 KiB) Viewed 870 times
But when i look data in chart and try to understand its plotting according to X and Y scale then plotting looks different with respect to data.
Means i am unable to understand how plotting is done on the data points those are not present in X,Y data list.

Please help me to understand the logic used behind the plotting of histogram.

Regards,
PlanoResearch

Christopher
Guru
Posts: 1129
Joined: Fri Nov 15, 2002 12:00 am

Re: Histogram plotting

Post by Christopher » Thu Jun 07, 2018 1:36 pm

Hello,

The Histogram series is optimized to draw series with equi-distant X values. Where data has disparate X values it is better to use an Area series with Stairs, e.g.

Code: Select all

		private void InitializeChart()
		{
			double[] xvalues = new double[] { 827, 837, 897, 929, 968, 1009, 1014, 1017, 1026, 1027, 1044, 1066, 1088, 1110, 1113, 1115, 1148, 1196, 1207, 1213, 1297, 1300, 1334, 1343, 1365 };
			double[] yvalues = new double[] { 2, 1, 0, 3, 14, 5, 4, 17, 18, 20, 13, 15, 16, 21, 19, 6, 12, 11, 7, 22, 8, 10, 23, 34, 9 };

			if(xvalues.Length == yvalues.Length)
			{
				Area series = new Area(tChart1.Chart);
				series.Stairs = true;
				series.Add(xvalues, yvalues);
			}
		}
TeeChartPro.vshost_2018-06-07_15-34-20.png
TeeChartPro.vshost_2018-06-07_15-34-20.png (25.35 KiB) Viewed 867 times
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

amol
Advanced
Posts: 226
Joined: Tue Mar 29, 2005 5:00 am

Re: Histogram plotting

Post by amol » Fri Jun 08, 2018 5:41 am

Hi Christopher,

You are right, but my need is that i have to filter data(means remove unwanted data) using histogram.
I am also little bit confused how i achieve this.

If you have any suggestion on this we will appreciate.

Regards,
PlanoResearch

Christopher
Guru
Posts: 1129
Joined: Fri Nov 15, 2002 12:00 am

Re: Histogram plotting

Post by Christopher » Fri Jun 08, 2018 7:15 am

amol wrote: You are right, but my need is that i have to filter data(means remove unwanted data) using histogram.
I am also little bit confused how i achieve this.
Why can't you filter data using the Area series?
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

amol
Advanced
Posts: 226
Joined: Tue Mar 29, 2005 5:00 am

Re: Histogram plotting

Post by amol » Fri Jun 08, 2018 10:45 am

Hi Christopher,

Actually my need is to plot data using Histogram.
I have also gone through with excel charts here i have plotted my data. i m attaching images of same. On excel my data plotted correctly. i want to plot similar in teechart.
img1.jpg
first image
img1.jpg (103.1 KiB) Viewed 856 times
As shown in first image data is plotted on histogram chart with 3 bins.
img2.jpg
second image
img2.jpg (104.41 KiB) Viewed 855 times
As shown in second image i have changed number of bins to 5. And after changing number of pillar/bars increased.
image3.jpg
third image
image3.jpg (332.93 KiB) Viewed 854 times
But in third image i have plotted same data with teechart but it plots data differently. why?
One more thing in teechart histogram, there is no property to set bins number. And my need is to change bins dynamically over the plotted data.

Kindly help i want to plot similar chart using teechart as plotted in excel.

Regards,
PlanoResearch

Christopher
Guru
Posts: 1129
Joined: Fri Nov 15, 2002 12:00 am

Re: Histogram plotting

Post by Christopher » Fri Jun 08, 2018 11:20 am

amol wrote: But in third image i have plotted same data with teechart but it plots data differently. why?
One more thing in teechart histogram, there is no property to set bins number. And my need is to change bins dynamically over the plotted data.

Kindly help i want to plot similar chart using teechart as plotted in excel.
Please bear in mind that, as a business, we cannot dedicate very much time to helping you write your applications without receiving payment for it. So any help you can give us whereby we can spend less time helping your write your applications is greatly appreciated. TeeChart was not specifically designed to replicate Excel functionality nor has it ever been sold as doing so, and as such we do not feel obliged to spend time, without payment, producing code which replicates Excel.

In this particular case, then, could you please spend some time making an attempt to produce the functionality you need so that we can run this code here to save us the time of writing it ourselves. As a guide you may like to consider Stackoverflow's directives for a Minimal, Complete, and Verifiable (MCVE) example you can read about here. Once in receipt of the MCVE you have written for us we can then help you in achieving your final goals.

Thank you.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

amol
Advanced
Posts: 226
Joined: Tue Mar 29, 2005 5:00 am

Re: Histogram plotting

Post by amol » Fri Jun 08, 2018 12:19 pm

Hi Steema Support,

As you suggested i am attaching demo for your help. Please find it from attachment.
We are using teechart version 2012.
CustomSubSchart.rar
demo
(55.26 KiB) Downloaded 63 times
regards,
Planoresearch

Christopher
Guru
Posts: 1129
Joined: Fri Nov 15, 2002 12:00 am

Re: Histogram plotting

Post by Christopher » Mon Jun 11, 2018 7:33 am

amol wrote: As you suggested i am attaching demo for your help. Please find it from attachment.
We are using teechart version 2012.
That you are using version 2012 means that it is six years since you have paid Steema for an upgrade. If all our clients did not pay for upgrades Steema would soon be out of business!

I have run your test project, but as far as I can see it does not reproduce a problem with TChart here. Neither does the project give any indication of your requirements, nor has any effort been made to produce a project which clearly shows where your problem is.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Post Reply