How to plot a 3d charts with gaps in the data

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
nathan
Newbie
Newbie
Posts: 10
Joined: Mon Feb 16, 2004 5:00 am

How to plot a 3d charts with gaps in the data

Post by nathan » Wed May 18, 2005 8:34 am

I have a patch of 3d data (say 7 by 5) which represents some statistics which have been binned. (the size of the bins are different in x and z)
I plot a 3d chart of the data and get a nice mountain / valley appearance.
I add a 'GetValueColor' to the chart so that I can colour the surface deending on the value

I am using 'irregular grid' although I am not sure what irregular grid actually means ?

I have 2 critical problems

1. I do not get an event for each position on the chart (and if I record events I get some of the values being asked for twice). So i can not set all the colours.

2. I do not want to to see some of the surface at all (ie it stands for no data as opposed to the data value being 0) so do not give a value to all points. For this data (say i do not provide a data point in the middle of the chart) the chart is not plotted properly at all. The chart also displays differently depending on how I load up the data (ie if I loop over x then z I get a different chart than looping over z then x). One of the two graphs will be correct.

How should I be doing my 3d chart ?

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 May 18, 2005 9:33 am

Hi nathan,
I am using 'irregular grid' although I am not sure what irregular grid actually means ?
The IrregularGrid property controls if X and Z values should be equidistant or not.
1. I do not get an event for each position on the chart (and if I record events I get some of the values being asked for twice). So i can not set all the colours.
You could use series BeforeDrawEvent.
2. I do not want to to see some of the surface at all (ie it stands for no data as opposed to the data value being 0) so do not give a value to all points. For this data (say i do not provide a data point in the middle of the chart) the chart is not plotted properly at all. The chart also displays differently depending on how I load up the data (ie if I loop over x then z I get a different chart than looping over z then x). One of the two graphs will be correct.

How should I be doing my 3d chart ?
Please have a look at this VCL forum thread. It is a case very similar to yours and can also be easily ported to .NET. Also notice that map series are available with TeeChart for .NET v2 BETA which can already be downloaded from 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

nathan
Newbie
Newbie
Posts: 10
Joined: Mon Feb 16, 2004 5:00 am

Post by nathan » Wed May 18, 2005 10:29 am

The IrregularGrid property controls if X and Z values should be equidistant or not.
Does that mean that the X is equidistant and the Z is equidistant, but the distances do not have to be the same (this is very unclear in the documentation)
1. I do not get an event for each position on the chart (and if I record events I get some of the values being asked for twice). So i can not set all the colours.

You could use series BeforeDrawEvent.
May be I am going around this the wrong way. I am trying to set the colour of each rectangle on the 3d surface plot. It appears that the colour used for a rectangle is the colour applied to the bottom right hand corner (correct ?) I was using GetValueColour to request this value. Why is this event not asking questions for all points ?
Is it alright to simply not assign data to some of the points in a grid ?
How should I be doing my 3d chart ?
Please have a look at this VCL forum thread. It is a case very similar to yours and can also be easily ported to .NET. Also notice that map series are available with TeeChart for .NET v2 BETA which can already be downloaded from our customer download area.
Unfortunately I have just noticed this bug before rolling out a product to a client, I can not really use Beta software.
I am also unsure which bit of the VCL issue relates to my problem.

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 May 18, 2005 10:49 am

Hi nathan,
Does that mean that the X is equidistant and the Z is equidistant, but the distances do not have to be the same (this is very unclear in the documentation)
Please have a look at the TeeChart features demo, available at the TeeChart Program group, and search for Irregular grid. Hope this helps you understand this method.
May be I am going around this the wrong way. I am trying to set the colour of each rectangle on the 3d surface plot. It appears that the colour used for a rectangle is the colour applied to the bottom right hand corner (correct ?)
You can assign each cell color with the Y Value as explained in the VCL thread I pointed you before. Using a ColorGrid X and Z values define a regular grid while Y values determine its cell colour. Please have a look at the VCL thread where SteveP and me where discussing about ColorGrid structure.
I was using GetValueColour to request this value. Why is this event not asking questions for all points ?
This is not an event, it's a .NET Framework method.
Is it alright to simply not assign data to some of the points in a grid ?
How should I be doing my 3d chart ?
No, if you want to use a ColorGrid series. To get this you should set cell's color to zero which would make them transparent.

In case you don't have a regular grid structure you should use bubble series (with square style), shape series or map series as I suggested SteveP in the VCL thread I mentioned.
Unfortunately I have just noticed this bug before rolling out a product to a client, I can not really use Beta software.


According to my previous answers this is not a bug. Regarding to TeeChart for .NET v2 it's expected to be released before the end of this month.
I am also unsure which bit of the VCL issue relates to my problem.
As I have already told you, I think ColorGrid series explanation and alternative solutions to get what you request (bubble series, shape series, map series) would help you.
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

nathan
Newbie
Newbie
Posts: 10
Joined: Mon Feb 16, 2004 5:00 am

Post by nathan » Wed May 18, 2005 11:07 am

Does that mean that the X is equidistant and the Z is equidistant, but the distances do not have to be the same (this is very unclear in the documentation)

Please have a look at the TeeChart features demo, available at the TeeChart Program group, and search for Irregular grid. Hope this helps you understand this method.
I have looked at the demo extensively yesterday and this has only added to the confusion.

my x axis goes from 1 to 7 with steps of .5
my z axis goes from 1 to 5 with step of .5

Is this regular or not ? (when I change the property to regular, my plot looks even weirder)

(however I do want to do x 1 to 7 steps 1, z 1 to 5 step .5 aswell)

I simply do not understand what regular means, does it mean
equidistant in x and y with the same separation
equidistant in x and y with the same range
equidistant in x and with the same separation and same range

I simply have a plot which could be drawn on graph paper where the x separation and y spearation are regular, but different.

What is the 'implication' of regular or not, how does that change my interaction with the API.

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 May 18, 2005 11:57 am

Hi nathan,
my x axis goes from 1 to 7 with steps of .5
my z axis goes from 1 to 5 with step of .5

Is this regular or not ? (when I change the property to regular, my plot looks even weirder)
Yes, this is regular. Your data could fit in a nested for loop structure as:

Code: Select all

for (double x=1; x<=7; x=x+0.5) //rows
				for (double z=1;z<=5; z=z+0.5) //columns
				{
					y = Math.Sin(z*Math.PI/10.0)*Math.Cos(x*Math.PI/5.0);  // example Y value
					colorGrid1.Add(x,y,z);
				}
(however I do want to do x 1 to 7 steps 1, z 1 to 5 step .5 aswell)
Ok, you can use it setting x increment to x=x+1.
I simply do not understand what regular means, does it mean
equidistant in x and y with the same separation
equidistant in x and y with the same range
equidistant in x and with the same separation and same range

I simply have a plot which could be drawn on graph paper where the x separation and y spearation are regular, but different.

What is the 'implication' of regular or not, how does that change my interaction with the API.
IrregularGrid method is necessary when x or z values intervals are not regular (i.e.: 1,2,2.1,2.5,3).

In case you want to have "holes" in the series you could do something like the code below, it's in Delphi and using a Surface series but should be easily portable to .NET

Code: Select all

procedure TSurfaceHolesForm.BitBtn2Click(Sender: TObject);
var x,z:Integer;
    tmp:Double;
begin
  CheckBox1.Enabled:=True;
  Series1.Clear;
  for x:=1 to 10 do
    for z:=1 to 10 do
    begin
      tmp:=cos(x/10.0)*sin(z/10.0);

      { apply hole at cells (5,5) to (6,6) }
      if ((x=5) or (x=6)) and ((z=5) or (z=6)) then
         Series1.AddXYZ( x, tmp, z, '', clNone )  { <-- NULL cell }
      else
         Series1.AddXYZ( x, tmp, z );
    end;
end;
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