Keep the chart in 2D view when moving or rotating.

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
sripe
Newbie
Newbie
Posts: 26
Joined: Thu Sep 10, 2015 12:00 am

Keep the chart in 2D view when moving or rotating.

Post by sripe » Wed Jan 27, 2016 9:05 am

Hello,
When move or rotate a chart using TeeCommander, the original 2D chart becomes a 3D chart by itself. How to keep a chart in 2D view when it been moved or rotated?
Best regards,
Xiushan

sripe
Newbie
Newbie
Posts: 26
Joined: Thu Sep 10, 2015 12:00 am

Re: Keep the chart in 2D view when moving or rotating.

Post by sripe » Wed Jan 27, 2016 9:07 am

Please find the attached files.
Attachments
fig2.jpg
fig2.jpg (42.59 KiB) Viewed 13608 times
Fig1.jpg
Fig1.jpg (35.83 KiB) Viewed 13595 times

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Keep the chart in 2D view when moving or rotating.

Post by Yeray » Wed Jan 27, 2016 2:42 pm

Hello,

That's a limitation on the rotation feature. It requires the chart to be in 3D to take effect.
Some alternatives I see:

- Set the Chart3DPercent to 0:

Code: Select all

Chart1.Chart3DPercent:=0;
- Change your TLineSeries for TFastLineSeries.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

sripe
Newbie
Newbie
Posts: 26
Joined: Thu Sep 10, 2015 12:00 am

Re: Keep the chart in 2D view when moving or rotating.

Post by sripe » Thu Jan 28, 2016 1:25 am

Using TeeCommander to move, rotate or zoom, the chart properties (such as series color) change.
Attachments
2.jpg
2.jpg (29.37 KiB) Viewed 13574 times
1.jpg
1.jpg (38.47 KiB) Viewed 13567 times

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Keep the chart in 2D view when moving or rotating.

Post by Yeray » Thu Jan 28, 2016 9:26 am

Hello,
sripe wrote:Using TeeCommander to move, rotate or zoom, the chart properties (such as series color) change.
If you are using the first approach - using a TLineSeries with Chart3DPercent=0 - I'd suggest you to also set the series' LinePen.Color to be the series' Color. Ie:

Code: Select all

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D:=false;
  Chart1.Legend.Visible:=false;

  Chart1.Chart3DPercent:=0;
  with Chart1.AddSeries(TLineSeries) as TLineSeries do
  begin
    FillSampleValues;
    LinePen.Color:=Color;
  end;
end;
The second approach - using a TFastLineSeries instead of a TLineSeries - may make more sense in this case.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

sripe
Newbie
Newbie
Posts: 26
Joined: Thu Sep 10, 2015 12:00 am

Re: Keep the chart in 2D view when moving or rotating.

Post by sripe » Fri Jan 29, 2016 2:49 am

Using the first approach, and the FormCreate procedure as follows:

Code: Select all

procedure Tform1.FormCreate(Sender: TObject);
begin
  with Chart1 do
    begin
      View3D := false;
      View3DWalls := false;
      Chart3DPercent := 0;
      View3DOptions.Rotation := 0;
      View3DOptions.Elevation := 360;
      View3DOptions.Perspective := 0;
    end;
end;
It works well with TLineSeries. But, using TeeCommander to move, rotate or zoom TPolarSeries, there are two problems:
1. When moving or zooming the chart, it inclines (tilts, leans) by itself. (see Fig1)
2. When rotating the chart, the selected series (there is a ChartListBox1 on the Form, and ChartListBox1.SelectedSeries is active) and the Chart rotate, but the other PolarSeries do not follow the rotating command. (see Fig2)
Attachments
Fig2.jpg
Fig2.jpg (339.91 KiB) Viewed 13558 times
Fig1.jpg
Fig1.jpg (320.31 KiB) Viewed 13546 times
Original.jpg
Original.jpg (336.67 KiB) Viewed 13536 times

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Keep the chart in 2D view when moving or rotating.

Post by Yeray » Fri Jan 29, 2016 3:46 pm

Hello,
sripe wrote:1. When moving or zooming the chart, it inclines (tilts, leans) by itself. (see Fig1)
I see it moving/zooming deactivates the 3D, but other than that I can move/zoom the chart around without problems:
polarmoved.png
polarmoved.png (79.78 KiB) Viewed 13522 times
I've only placed a TChart and a TTeeCommander on a form and I use this code:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  with Chart1 do
  begin
    //View3D := false;
    Chart3DPercent := 0;
    Gradient.Visible:=false;
    Title.Visible:=false;
    Legend.Visible:=false;
  end;

  for i:=0 to 1 do
    with Chart1.AddSeries(TPolarSeries) as TPolarSeries do
    begin
      FillSampleValues;
      Pointer.Visible:=false;
      Brush.Clear;
      CircleBrush.Clear;
      Pen.Color:=Color;
      Pen.Width:=2;
    end;
end;
sripe wrote:2. When rotating the chart, the selected series (there is a ChartListBox1 on the Form, and ChartListBox1.SelectedSeries is active) and the Chart rotate, but the other PolarSeries do not follow the rotating command. (see Fig2)
I've added it to the public tracker:
http://bugs.teechart.net/show_bug.cgi?id=1423
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

sripe
Newbie
Newbie
Posts: 26
Joined: Thu Sep 10, 2015 12:00 am

Re: Keep the chart in 2D view when moving or rotating.

Post by sripe » Sat Jan 30, 2016 1:36 am

Please press move or zoom button to test.
Attachments
Example4.zip
(6.88 KiB) Downloaded 593 times

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Keep the chart in 2D view when moving or rotating.

Post by Yeray » Mon Feb 01, 2016 8:41 am

Hello,

This is because when you start moving the chart it changes to 3D and the other properties (Elevation, Rotation, Orthogonal,...) take effect
Try setting Orthogonal to true or Elevation and Rotation to 360 after creating the series. Ie:

Code: Select all

  with Chart1 do
    begin
      //Aspect.Orthogonal:=true;
      Aspect.Elevation:=360;
      Aspect.Rotation:=360;
    end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

sripe
Newbie
Newbie
Posts: 26
Joined: Thu Sep 10, 2015 12:00 am

Re: Keep the chart in 2D view when moving or rotating.

Post by sripe » Tue Feb 16, 2016 7:11 am

Using TPolarSeries, it seems that the four axes (RightAxis, LeftAxis, TopAxis and BottomAxis) do not intersect the same point at the center, although I use the following codes to make the chart show in 2D view.
with Chart1 do
begin
View3D := false;
View3DWalls := false;
Chart3DPercent := 0;
Aspect.Rotation := 360;
Aspect.Elevation := 360;
Aspect.Perspective := 0;
Gradient.Visible := true;
end;
How to make the four axes just right meet at the centre of a circle?
Attachments
www.jpg
www.jpg (241.13 KiB) Viewed 13487 times

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Keep the chart in 2D view when moving or rotating.

Post by Yeray » Tue Feb 16, 2016 11:34 am

Hello,
sripe wrote:Using TPolarSeries, it seems that the four axes (RightAxis, LeftAxis, TopAxis and BottomAxis) do not intersect the same point at the center, although I use the following codes to make the chart show in 2D view.
I see. I've added it to the public tracker:
http://bugs.teechart.net/show_bug.cgi?id=1439
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply