AxisTooltip icon indicating copy to clipboard operation
AxisTooltip copied to clipboard

How to align text to top

Open arbyruns opened this issue 3 years ago • 2 comments

I'm trying to understand how to apply the Axis Text to appear at the top of where axisToolTip is being applied.

Code:

 .axisToolTip(isPresented: $tooltip, alignment: .bottomTrailing, constant: constant, foreground:  {
                                    Label("Contrary to popular belief, Lorem Ipsum is not simply random text.", systemImage: "heart")
                                        .padding()
                                        .frame(width: 200)
                                })

Result

image

Expected

image

arbyruns avatar Apr 07 '22 19:04 arbyruns

I sort of figured it out, but I needed to have a constant similar to the below

@State private var constant: ATConstant = .init(axisMode: .top)

Is this the only way to specify the position in the case I have more than one Tooltip?

arbyruns avatar Apr 07 '22 20:04 arbyruns

@arbyruns, Just make different configs for different axis

Mcrich23 avatar Mar 21 '23 18:03 Mcrich23