UsePartnerAxis, PartnerAxis do not limit the grid lines

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
hel
Newbie
Newbie
Posts: 3
Joined: Thu Dec 15, 2016 12:00 am

UsePartnerAxis, PartnerAxis do not limit the grid lines

Post by hel » Tue Oct 17, 2017 5:13 pm

According reference http://www.teechart.net/docs/TeeChartVCLReference.htm, Grid zoning (defined with UsePartnerAxis, PartnerAxis) permits the pairing of Axes so that Gridlines plotted from either Axis are delimited by the zone of the partner. But at least in version 2017.21.170329, when 2 custom axes are used, the grid lines are through the whole chart. see:
Current2.png
Current2.png (22.47 KiB) Viewed 8776 times
. Desired:
desired2.png
desired2.png (22.09 KiB) Viewed 8771 times

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var
  ax, ay: TChartAxis;
  ser: TFastLineSeries;
begin
  ax:= Chart1.CustomAxes.Add;
  ax.Horizontal:= TRUE;
  ax.StartPosition:= 20.0;
  ax.EndPosition:= 80.0;
  ax.PositionPercent:= 20;
  ax.axis.Color:= clBlue;

  ay:= Chart1.CustomAxes.Add;
  ay.StartPosition:= 20.0;
  ay.EndPosition:= 80.0;
  ay.PositionPercent:= 20;
  ay.Axis.Color:= clRed;

  ax.UsePartnerAxis:= TRUE;
  ax.PartnerAxis:= ay;

  ay.UsePartnerAxis:= TRUE;
  ay.PartnerAxis:= ax;

  ser:= TFastLineSeries.Create(Chart1);
  chart1.AddSeries(ser);
  ser.CustomHorizAxis:= ax;
  ser.CustomVertAxis:= ay;
  ser.FillSampleValues(100);
end;

How can I make the grid lines to show only in the area limited by the custom axes?
Thanks in advance

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

Re: UsePartnerAxis, PartnerAxis do not limit the grid lines

Post by Yeray » Wed Oct 18, 2017 7:25 am

Hello,

What TeeChart version are you using?

This is what I get with your code in TeeChart Pro v2017.22:
Image

I only added this to your code:

Code: Select all

  Chart1.View3D:=False;
  Chart1.Legend.Visible:=False;
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

hel
Newbie
Newbie
Posts: 3
Joined: Thu Dec 15, 2016 12:00 am

Re: UsePartnerAxis, PartnerAxis do not limit the grid lines

Post by hel » Wed Oct 18, 2017 12:44 pm

hello Yeray,
Thank you for the quick answer. As I mentioned in my post, version 2017.21 is used, but from your post I understand that the problem persists also in 2017.22 in 3DView mode.

Chart1.View3D:= FALSE sorts the problem until we put TTeeCommander.
CommanderUsed.png
CommanderUsed.png (46.99 KiB) Viewed 8757 times
As soon as drag/zoom buttons of TTeeCommander are used - the chart switches to 3DView mode and the grid is not clipped anymore. Some time ago I found a suggested solution for this problem to keep the chart in 3DView mode with 1% (may be by you).

In my opinion, there are several issues that should be fixed at some point (better sooner than later):
- TTeeCommander should not change 3DView mode to TRUE after drag or zoom.
- CustomAxis with PartnerAxis set should clip the grid lines even in 3DView.
- It should be possible to set that a CustomAxis reacts on Zoom event or ignores it (off current topic, but just to mention it).

PartnerAxis was introduced in 2010, as I could read. I cannot understand how nobody reported the problem.

Best regards

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

Re: UsePartnerAxis, PartnerAxis do not limit the grid lines

Post by Yeray » Fri Oct 20, 2017 11:34 am

Hello,
hel wrote:As I mentioned in my post, version 2017.21 is used
Sorry, I missed that part.
hel wrote:but from your post I understand that the problem persists also in 2017.22 in 3DView mode.

Chart1.View3D:= FALSE sorts the problem until we put TTeeCommander.
That's right. It works as you wish for 2D only, also with the default axes:

Code: Select all

uses Series;

procedure TForm1.FormCreate(Sender: TObject);
var ser: TFastLineSeries;
begin
  Chart1.Legend.Visible:=False;
  Chart1.View3D:=False;

  with Chart1.Axes.Bottom do
  begin
    StartPosition:= 20.0;
    EndPosition:= 80.0;
    PositionPercent:= 20;
    Axis.Color:= clBlue;
    UsePartnerAxis:=True;
    PartnerAxis:=Chart1.Axes.Left;
  end;

  with Chart1.Axes.Left do
  begin
    StartPosition:= 20.0;
    EndPosition:= 80.0;
    PositionPercent:= 20;
    Axis.Color:= clRed;
    UsePartnerAxis:=True;
    PartnerAxis:=Chart1.Axes.Bottom;
  end;;

  ser:= TFastLineSeries.Create(Chart1);
  chart1.AddSeries(ser);
  ser.FillSampleValues(100);
end;
hel wrote:- TTeeCommander should not change 3DView mode to TRUE after drag or zoom.
I'm afraid the Zoom feature only works in 2D for OpenGL. The rest of Canvases need 3D to Zoom, so they force it.
You can try OpenGL with this:

Code: Select all

uses TeeGLCanvas;
//...
  Chart1.Canvas:=TGLCanvas.Create;
hel wrote:- CustomAxis with PartnerAxis set should clip the grid lines even in 3DView.
I've added it to the public tracker and already fixed it for the next maintenance release.
http://bugs.teechart.net/show_bug.cgi?id=1930
hel wrote:- It should be possible to set that a CustomAxis reacts on Zoom event or ignores it (off current topic, but just to mention it).
By default CustomAxes don't automatically zoom so you have to implement it by code. Don't hesitate to let us know if you find problems with it.
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