Page 1 of 1

TIsoSurfaceSeries and XZ plot

Posted: Thu Feb 17, 2011 6:33 pm
by 10553474
Hi!
I am trying to draw an array of values with the TIsoSurfaceSeries, and I want to display my data in XZ-plane. The problem is that when I set View3D:=false, TeeChart is using XY-plane to display the data. How can I set up 2D views of TIsoSurfaceSeries' objects (TeeChartPro 8.05)?

Re: TIsoSurfaceSeries and XZ plot

Posted: Fri Feb 18, 2011 12:04 pm
by yeray
Hi toxi,

Have you tried using a ColorGrid instead of a Surface in 2D or viewed from the top?

Suface Series viewed from the top:

Code: Select all

uses TeeSurfa;

procedure TForm1.FormCreate(Sender: TObject);
var x, z: integer;
begin
  Chart1.Chart3DPercent:=100;
  Chart1.Aspect.Orthogonal:=false;
  Chart1.Aspect.Zoom:=70;
  Chart1.Aspect.Rotation:=0;
  Chart1.Aspect.Elevation:=270;
  Chart1.Legend.Visible:=false;

  with Chart1.AddSeries(TSurfaceSeries) as TSurfaceSeries do
  begin
    for x:=0 to 9 do
      for z:=0 to 9 do
        AddXYZ(x, random*10, z);
  end;
end;
ColorGrid Series:

Code: Select all

uses TeeSurfa;

procedure TForm1.FormCreate(Sender: TObject);
var x, z: integer;
begin
  Chart1.View3D:=false;
  Chart1.Legend.Visible:=false;

  with Chart1.AddSeries(TColorGridSeries) as TColorGridSeries do
  begin
    for x:=0 to 9 do
      for z:=0 to 9 do
        AddXYZ(x, random*10, z);
  end;
end;
If that's not what you are trying to do, please try to arrange a simple example project we can run as-is to reproduce the problem here.

Re: TIsoSurfaceSeries and XZ plot

Posted: Fri Feb 18, 2011 9:02 pm
by 10553474
Hi Yeray,

Thanks! Your answer was helpful. But I have some problems.

1) There is no filled area on the Fig.1. Values Y=YValues.MaxValue (13e-4) are located under no filled area.
2) When I zoom, surface is out of axis (fig. 2).
Fig .1
Image
Fig. 2
Image

Re: TIsoSurfaceSeries and XZ plot

Posted: Tue Feb 22, 2011 1:55 pm
by yeray
Hi toxi,
toxi wrote:1) There is no filled area on the Fig.1. Values Y=YValues.MaxValue (13e-4) are located under no filled area.
Could you please try to arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
toxi wrote:2) When I zoom, surface is out of axis (fig. 2).
You could try doing something similar to the demo at "All features\Welcome !\Axes\Opaque zones" in the feature demo program included in the installation.
If you still have problems with it, don't hesitate to let us know.

Re: TIsoSurfaceSeries and XZ plot

Posted: Wed Feb 23, 2011 12:40 am
by 10553474
Hi Yeray

I uploaded TestIsoSurf.zip. Project compiled with Delphi 6 and TeeChartPro v.8.07.
There are problems in this project:
1) The array of values from Data.xml (program load it when started) is painted not correctly in the TeeChart. But a ChartEditor.Data's table shows perfectly this data when button "3D" is not down. If the ChartEditor.Data's button "3D" is down, table shows the array of data also not correctly. Source_Field.xml contains the field of data, which I am trying to draw using TeeChart
2) There is no filled area with a values=YValues.MaxValue
3) The problem with zoom is disappear in TeeChart 8.07 (Early I used 8.05) , about which I wrote in the previous post. But zoomed area is shifted relatively the left-top point of zoom's rectangle in this version.
I'm sorry, my English is bad.

Please help!

Re: TIsoSurfaceSeries and XZ plot

Posted: Fri Feb 25, 2011 12:01 pm
by yeray
Hi toxi,

We think this could be probably better to be drawn with a Contour or a ColorGrid series. Here is how it looks changing the series to a Contour series:

Code: Select all

procedure TFIsoSurf.FormCreate(Sender: TObject);
var tmpSeries: TChartSeries;
begin
{  Chart1.Chart3DPercent:=100;
  Chart1.Aspect.Orthogonal:=false;
  Chart1.Aspect.Zoom:=70;
  Chart1.Aspect.Rotation:=0;
  Chart1.Aspect.Elevation:=270;
  Chart1.Aspect.Perspective:=0;
}
  Chart1.View3D:=False;

  Chart1.Legend.Visible:=true;
  XMLSource.FileName:=ExtractFileDir(paramstr(0))+'\Data.xml';
  XMLSource.Load;
  TIsoSurfaceSeries(Chart1.Series[0]).PaletteSteps:=4;
  TIsoSurfaceSeries(Chart1.Series[0]).ValueFormat:='00e-0';
  tmpSeries:=Chart1[0];
  ChangeSeriesType(tmpSeries, TContourSeries);
end;
Contour.jpg
Contour.jpg (122.49 KiB) Viewed 5589 times

Re: TIsoSurfaceSeries and XZ plot

Posted: Sun Feb 27, 2011 7:42 pm
by 10553474
Hi Yeray,

There was a mistake on the screenshot from your previuos post: the central area of figure must not be grey colored. Maybe it is a bug with a Palette using. I found what the subfunction CalcFirstLevel of method TIsoSurfaceSeries.DrawCell(x, z: Integer) returns the wrong result - second level in palette. I changed the CalcFistLevel how it looks below. You can see the result on screenshot. It seems that the Controurseries and IsoSurfaceSeries fill correctly.

Code: Select all

  
TeeSufra.pas

procedure TIsoSurfaceSeries.DrawCell(x, z: Integer);
....
function CalcFirstLevel:Integer;
  var i: Array[0..3] of Integer;
      t: Integer;
      tmpM,
      tmpV : TChartValue;
  begin
    // Search first palette level
    i[0]:=ValueIndex0;
    i[1]:=ValueIndex1;
    i[2]:=ValueIndex2;
    i[3]:=ValueIndex3;

    tmpMin:=i[0];
    tmpV:=v[tmpMin];
    tmpM:=tmpV;
    tmpMax:=tmpMin;

    for t:=1 to 3 do
    begin
      if v[i[t]]<tmpV then
      begin
        tmpV:=v[i[t]];
        tmpMin:=i[t];
      end
      else
      if v[i[t]]>tmpM then
      begin
        tmpM:=v[i[t]];
        tmpMax:=i[t];
      end;
    end;

    result:=-1;

    for t:=0 to PaletteLength-1 do
    With Palette[t] do
//if UpToValue>tmpV then 
// fix
    if UpToValue>=tmpV then
//
    begin
      result:=t;
      break;
    end;
  end;
Filled ContourSeries
Image

Re: TIsoSurfaceSeries and XZ plot

Posted: Mon Feb 28, 2011 2:48 pm
by yeray
Hi toxi,

I've added your suggestion to the wish list to be studied for future releases (TV52015423).
Anyways, I'm glad to see you've found a way to draw it as you want.

Re: TIsoSurfaceSeries and XZ plot

Posted: Fri Mar 25, 2011 11:05 am
by narcis
Hi toxi,

Thanks for your feedback. Just wanted to let you know that I have included your enhancement suggestion for next TeeChart VCL release.