Stacked bar plot showing same colors on a value that crosses over the x-axis


I’m using this on a shiny app where I want to create a stacked bar plot. I want to bar plot to essentially show what the line plot is showing but stacking the negative values from 0 going down and the positive values stacking together and going up from 0. Why is the color of the barchart crossing over the x axis even though the value is negative? I’m using shiny to select the colors to be displayed in the chart

    output$barPlot <- renderPlotly({
      req(input$xcol, input$metrics)
      # Get the filtered data
      filtered <- filtered_data()

      fig <- plot_ly(data = filtered, x = ~get(input$xcol))
      lapply(input$metrics, function(metric) {
        fig <<- fig %>% add_trace(y = ~get(metric), name = metric, type = 'bar', color = metric
      } )
      fig %>% layout(xaxis = list(title = "Date"), yaxis = list(title = "Metrics"), barmode = 'stack'