Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DasAnnotation anchorType=plot, other annotation clean up #47

Open
7 of 16 tasks
jbfaden opened this issue Feb 11, 2023 · 12 comments
Open
7 of 16 tasks

DasAnnotation anchorType=plot, other annotation clean up #47

jbfaden opened this issue Feb 11, 2023 · 12 comments

Comments

@jbfaden
Copy link
Member

jbfaden commented Feb 11, 2023

DasAnnotation has always had three modes to anchor (position) the annotation: canvas, plot, and data. I think the original idea was that "data" was going to allow anchoring to data, where the bounds of the data were going to be used to position the data. This never happened, and a simple bounding box (xrange = 20 to 25; yrange = 40 to 45) is allowed and Autoplot scripts are used to identify the data bounds. The "plot" mode was going to anchor to axes, but is never used because this is what the data position does. (Canvas just anchors to a row and column, or null values are just the entire canvas.) Further complicating things, we later added a verticalAnchorType which allows the two dimensions to be independently controlled.

I'd like for the "plot" to be made useful, where inside anchorPositions will clip using the plot clip, and outside anchorPositions will clip using reasonable boundaries so that adjacent plots are not affected. (Item 1)

There is additional cleanup which is needed, such as an improved GUI to control it, which Autoplot could use. (It has a quick one I threw together, but I don't think it's very effective.) (Item 2)

One still cannot rotate annotations, and this is an obvious feature that is overdue (Item 3). The properties "url" and "scale" should be deprecated since painters can be used for images (Item 4). "<img>" tags were supposed to be supported as well, but that's a different ticket (Item 5).

Last, there needs to be a clean document describing annotation use (Item 6).

See #21, and Autoplot ticket https://sourceforge.net/p/autoplot/bugs/1696/ .

  • 1. Precisely define "PLOT" anchorType to mean anchor to a plot row and column, with clipping.
  • 2. Improve GUI for controls
  • 3. Allow for annotation rotation (90 degree, then arbitrary)
  • 4. deprecate "url" and "scale", removing these from GUIs
  • 5. support <img> in GrannyTextRenderer (GrannyTextEditor should support <img> tag, deprecate url property of annotations #21)
  • 6. new, accessible, and correct documentation
  • 7. correct "point at" which moves the annotation.
  • 8. "move annotation" adjusts anchorOffsets, but does not consider splitAnchorType.
  • 9. "move annotation" sign errors.
  • 10. add "underscore" border type.
  • 11. adjustment for tightness of margins.
  • 12. "data" anchors to the pointAt position, not the xrange, yrange box. This is very confusing and it should be the box. (Is this the same as item 7?)
  • 13. AnchorType canvas should support pointAt when a plot is identified.
  • 14. The anchor box controls should be similar to the series renderer controls.
  • 15. The editor can have multiple tabs to simplify controls
  • 16. The anchor rectangle can be marked with ellipse
@jbfaden
Copy link
Member Author

jbfaden commented Feb 11, 2023

Also I'd like for there to be a way to specify how tight the margins are around the text. It looks like it's roughtly 1em right now, but sometimes I'd like to have no margin at all.

@jbfaden
Copy link
Member Author

jbfaden commented Feb 11, 2023

Also there should be a border type where it is just an underline, which can be used for pointing.

image

@jbfaden
Copy link
Member Author

jbfaden commented Feb 11, 2023

The bounds of a plot or data anchored annotation are not clipped properly, and slightly overlap the plot bounds.

image

@jbfaden
Copy link
Member Author

jbfaden commented Feb 11, 2023

@jbfaden
Copy link
Member Author

jbfaden commented Feb 12, 2023

(Item 7) The "point at" mouse module included within the annotations would adjust the anchorOffsets, incorrectly. The pointAt point is different that the xrange and yrange which position the annotation, and the two should not be coupled.

@jbfaden
Copy link
Member Author

jbfaden commented Feb 12, 2023

(Item 8) "move annotation" adjusts anchorOffsets, but does not consider splitAnchorType.

@jbfaden
Copy link
Member Author

jbfaden commented Feb 12, 2023

(Item 9) "move annotation" has a sign error in Y when anchorPosition is OutsideNE. All branches of adjustAnchorOffset should be reviewed.

This script is useful:

from org.das2.graph import AnchorPosition

i=0
for v in AnchorPosition.values():
    annotation( i, anchorPosition=v, text=str(v) )
    i=i+1

@jbfaden
Copy link
Member Author

jbfaden commented Feb 12, 2023

Item 8 was not a bug. There is no special consideration needed.

jbfaden added a commit that referenced this issue Feb 15, 2023
type works like canvas but is clipped by the plot bounds.
jbfaden added a commit that referenced this issue Feb 15, 2023
border type.
jbfaden added a commit that referenced this issue Feb 15, 2023
border type.
jbfaden added a commit that referenced this issue Feb 15, 2023
with rotation (do not use)
jbfaden added a commit that referenced this issue Feb 15, 2023
"point at" action would incorrectly adjust the anchorOffset.
jbfaden added a commit that referenced this issue Feb 15, 2023
Review of move annotations showed that four of the anchorPositions
we mis-coded.
@jbfaden
Copy link
Member Author

jbfaden commented Apr 29, 2023

I realized there is no way to attach an annotation to the data and have it draw outside the plot, like so:

image

I experimented with this and it seems like we'll need another control. anchorType "data" and "plot" both clip.

jbfaden added a commit that referenced this issue Apr 29, 2023
to see if annotation could point to data from outside the plot.
@jbfaden
Copy link
Member Author

jbfaden commented Dec 7, 2023

(7 and 12) I've always found the DATA mode for positioning strange, and I think I've finally figured out why. When "showArrow" was on, it would use the pointAt position to locate, and the xrange,yrange box otherwise. I'm correcting this, but I'm this will likely break existing products. It's always a good idea to favor the simpler code, and this is the simpler solution (and it removes about 12 lines of code).

jbfaden added a commit that referenced this issue Dec 7, 2023
getAnchorBounds to just return the xrange,yrange box.  This is simpler
and consistent with documentation I see in several places.
@jbfaden
Copy link
Member Author

jbfaden commented Dec 14, 2023

I found that with splitAnchor type and verticalAnchorType=CANVAS, the anchor would still be clipped. This is fixed.

jbfaden added a commit that referenced this issue Dec 14, 2023
splitAnchorType is used.
jbfaden added a commit that referenced this issue Dec 15, 2023
should never clip.
@jbfaden
Copy link
Member Author

jbfaden commented Dec 15, 2023

#92 where GrannyTextRenderer doesn't clip painters properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant