gui-cs / Terminal.Gui

Cross Platform Terminal UI toolkit for .NET
MIT License
9.55k stars 680 forks source link

`GraphView` assumes `Frame == Bounds` #2989

Open tig opened 10 months ago

tig commented 10 months ago

Change any of the graph view samples in GraphViewExample.cs to have a border to repro:

e.g.

graphView.BorderStyle = LineStyle.Single;

image

In addition & related, GraphView has properties duplicative of v2's Frames. E.g.

/// <summary>
/// Amount of space to leave on left of control.  Graph content (<see cref="Series"/>)
/// will not be rendered in margins but axis labels may be
/// </summary>
public uint MarginLeft { get; set; }

/// <summary>
/// Amount of space to leave on bottom of control.  Graph content (<see cref="Series"/>)
/// will not be rendered in margins but axis labels may be
/// </summary>
public uint MarginBottom { get; set; }

I noticed this as I was reviewing #2981.

BDisp commented 10 months ago

If you want to use border in the legend annotations you have two choices:

Do you have ani idea for this?

tig commented 10 months ago

If you want to use border in the legend annotations you have two choices:

  • Add a View to the GraphView and set the Border.
  • Draw a frame directly to the driver without using a View. Thus the obsolete method would be necessary.

Do you have ani idea for this?

Since legend annotations are not a View, I have no issue with how you updated the code to use the new View.DrawFrame method you provided in #2982.

The fact that in your View.DraweFrame you defer rendering (via OnRenderLineCanvas) should make magic happen. I opened THIS issue because I was heading down the path of testing whether it would or not. What I mean by magic is:

"If the legend annotation is positioned such that its border touches either theGraphView border or if it's SuperView's border, line-auto-join does what one would expect."

But, until the bug I am reporting in THIS issue is addressed, it's not possible to prove the above will work or not.

BDisp commented 10 months ago

I added a view for the legend annotations. See #2982.