Skip to content

Stop chart from animating #253

@PedroCavaleiro

Description

@PedroCavaleiro

I know it might seem a duplicate but I can't stop from animating even with the solution in the issue #102

Remember that I tried to add the .animation(nil) to the end of the DoughnutChart (after the padding modifier)

I also tried to use the .easeOut animation

Although this is contained within the MyProjectApp and AppContainerView() none of those have animation modifiers anywhere

I'm loading the data .onAppear

This is the code

// body code for HomeView()
NavigationStack {
            ZStack(alignment: .top) {
                themeProvider.view
                    .ignoresSafeArea(.all)
                if let chartData = carCharts {
                    VStack(alignment: .leading, spacing: 2) {
                        Text("Ignition States")
                            .font(.headline)
                            .padding(.top, 15)
                            .padding(.leading, 8)
                        HStack(spacing: 40) {
                            DoughnutChart(chartData: chartData)
                                .disableAnimation(chartData: chartData, true)
                                .frame(width: 105, height: 75)
                                .padding(.vertical, 25)
                            VStack(alignment: .leading) {
                                HStack {
                                    Circle()
                                        .fill(themeProvider.danger)
                                        .frame(width: 20, height: 20)
                                    Text("\(offCount) off")
                                }
                                HStack {
                                    Circle()
                                        .fill(themeProvider.warning)
                                        .frame(width: 20, height: 20)
                                    Text("\(idleCount) idle")
                                }
                                HStack {
                                    Circle()
                                        .fill(themeProvider.success)
                                        .frame(width: 20, height: 20)
                                    Text("\(onCount) on")
                                }
                            }
                            Spacer()
                        }
                    }
                        .padding(.horizontal, 20)
                        .background(
                            RoundedRectangle(cornerRadius: 15)
                                .fill(themeProvider.card)
                                .addShadow(radius: 5)
                        )
                        .padding(.horizontal, 20)
                        .padding(.top, 15)
                }
            }
                .navigationTitle("Home")
        }
ScreenRecording_04-03-2025.14-59-18_1.mov

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions