Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with shiny navbarMenu page. #24

Open
kismsu opened this issue Apr 16, 2015 · 1 comment
Open

Doesn't work with shiny navbarMenu page. #24

kismsu opened this issue Apr 16, 2015 · 1 comment
Assignees

Comments

@kismsu
Copy link

kismsu commented Apr 16, 2015

Hi, for some reasons if you put metricsgraphics on navbarMenu page, you can't access tabs.
Here is a small example.

library(shiny)
library(metricsgraphics)

ui = shinyUI(navbarPage("Navbar!",
                        tabPanel("Home", h3("MetricsGraphics Example")),
                        navbarMenu("Plots",
                                   tabPanel("Plot1",
                                        metricsgraphicsOutput('mjs1')
                                    ),
                                    tabPanel("Plot2",
                                        metricsgraphicsOutput('mjs2')
                                    )
                        )
))

server = function(input, output) {

    mtcars %>%
        mjs_plot(x=wt, y=mpg, width=400, height=300) %>%
        mjs_point(color_accessor=carb, size_accessor=carb) %>%
        mjs_labs(x="Weight of Car", y="Miles per Gallon") -> m1

    set.seed(1492)
    stocks <- data.frame(
        time = as.Date('2009-01-01') + 0:9,
        X = rnorm(10, 0, 1),
        Y = rnorm(10, 0, 2),
        Z = rnorm(10, 0, 4))

    stocks %>%
        mjs_plot(x=time, y=X) %>%
        mjs_line() %>%
        mjs_add_line(Y) %>%
        mjs_add_line(Z) %>%
        mjs_axis_x(xax_format="date") %>%
        mjs_add_legend(legend=c("X", "Y", "Z")) -> m2

    output$mjs1 <- renderMetricsgraphics(m1)

    output$mjs2 <- renderMetricsgraphics(m2)

}

shinyApp(ui = ui, server = server)
@hrbrmstr hrbrmstr self-assigned this Jun 12, 2015
@Auburngrads
Copy link

Second this. I have a similar app to what @kismsu has shown above. Changing metricsgraphicsOutput to plotOutput (while keeping everything else the same) allows me to pull down the navbarMenu options, although this obviously does not show the plot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants