Create interaction between charts and table using javascript/d3.js in a flexdashboard

Viewed 146

I create the flexdashboard below in which I use 3 dataframes. Then two of these dataframes are displayed as charts(dcross1,dcross2) and one (dcross3) as table. What I want to achieve is to connect all of these objects together in a way that when the user clicks on a bar the table will be subseted accordingly. Not the other charts only the table. Im looking for only a javascript/shiny solution and not a solution using crosstalk package.

---
title: "Operaitonal dashboard"
author: "Report"
date: 'Date: `r Sys.Date()`'
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    theme: lumen
    vertical_layout: scroll
---

```{r setup, include=FALSE}


knitr::opts_chunk$set(echo=FALSE,
                      warning= FALSE,
                      message = FALSE)
library(shiny)
library(plotly)
library(flexdashboard)
library(ggplot2)
library(dplyr)
library(reactable)
##The dataframes

Abcd<-c("A","A","B","B")
Prod<-c(34,56,56,89)
Div<-c("Ent","Ent","App","High")
dcross1<-data.frame(Abcd,Prod,Div)


Counts<-c(45,67,78,56)
dcross2<-data.frame(Div,Abcd,Counts)

dcross3<-data.frame(Div,Abcd,Counts)

```

# Out of stock Report {data-icon="fa-cart-arrow-down" data-orientation=rows}

## Row {data-height="200"}

### Out Of Stock: Store Overview {data-width="200"}

```{r Oos Store}
daily_store_oos_gg<-
  ggplot(dcross1,
         aes(x=Abcd,
             y=Prod,
             fill=as.factor(Abcd)
             )) +
  geom_bar(stat="identity", position="dodge") 

# Convert to plotly object
daily_store_oos_ply <- 
  ggplotly(daily_store_oos_gg)

daily_store_oos_ply
```



## Column {data-width=405}
```{r Oos Store2}
daily_store_oos_gg2<-
  ggplot(dcross2,
         aes(x=Abcd,
             y=Prod,
             fill=as.factor(Abcd)
             )) +
  geom_bar(stat="identity", position="dodge") 

# Convert to plotly object
daily_store_oos_ply2 <- 
  ggplotly(daily_store_oos_gg2)

daily_store_oos_ply2
```

### Store Overview Out of Stock
```{r out of stock reactable}
daily_item_oos_rctble<-reactable(
    dcross3
    )

daily_item_oos_rctble

```
0 Answers
Related