Swift Charts Annotation: Shadow applies incorrectly - too thick

41 views Asked by At

Maybe someone could help me figure it out customization issues with annotations I have in Swift Charts: I have RuleMark for my line chart. RuleMark has annotation, which displays another view. That view has shadow modifier. On preview shadow for popover looks the way I intend it to look. Proper shadow. But whenever annotation is displayed on top of the chart it look too thick and differently. Improper shadow

RuleMark(
                    x: .value("Year", rawSelectedYear)
                )
                .foregroundStyle(Color.gray.opacity(0.3))
                .offset(yStart: -10)
                .zIndex(1)
                .annotation(
                    position: .top,
                    alignment: .leading,
                    spacing: 0,
                    overflowResolution: .init(
                        x: .fit(to: .chart),
                        y: .disabled
                    )
                ) {
                    let selectedData = calculator.investmentData[rawSelectedYear]
                    
                    ChartPopoverView(//omitted)
                    )
                }

ChartPopoverView has VStack with a few text properties:

var body: some View {
        VStack(alignment: .leading) {
            Text("Year \(year)")
                .applyCaptionStyle()
                .padding(.bottom, 1)
            
            //Omitted
        }
        .frame(width: 200)
        .padding()
        .background(.popoverBackground)
        .cornerRadius(15)
        .shadow(radius: 3)
    }
0

There are 0 answers