【问题标题】:scrollable tab in flexdashboardflexdashboard 中的可滚动选项卡
【发布时间】:2021-02-22 21:43:18
【问题描述】:

我希望一切都好。

我有这个 flexdashboard 应用程序。 [1]:https://i.stack.imgur.com/mqiWV.png 而且我希望“注释和公式”选项卡可以滚动,因为我打算写很多解释。

以下是我使用的代码

---
title: "Finance"
runtime: shiny
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    vertical_layout: fill
    smooth_scroll: true
    
    theme: simplex
---

```{r setup, include=FALSE}
library(flexdashboard)
library(fBasics)
library(FinTS)
library(tidyquant)
library(shiny)
library(quantmod)
library(ggplot2)
library(highcharter)
library(shinyjs)
library(htmltools)
scroll_css = "<style> #section-text {overflow-y: scroll;}</style>"
```

Sidebar {.sidebar}
=========================================
```{r echo=FALSE}
tags$h5("Please click the submit button after every input change")
tags$hr()

textInput("tickers","Ticker",value = "",placeholder = "tickers")
dateInput("from","Starting Date",format = "yyyy-mm-dd")
sliderInput("k","Number of Period",min = 0,max = 250,value = 10)
checkboxGroupInput("priceKind","Kind (Choose 1)",c("Open","High","Low","Close"),selected = "Close",inline = TRUE)
# Close = Adjusted
kind = c("Open","High","Low","Close")
kindIndex = c(1,2,3,4)
names(kindIndex) = kind

numericInput("x","Initial Investment in $",value = 0)
sliderInput("m","Number of Periods of Interest Payment per annum",min = 1,max = 365,value = 2)
sliderInput("r","Interest year per annum",min = 0,max = 1,value = 0.05)

actionButton("go","Submit")
```

CH 1
=========================================

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

### Notes and Formulas
```{r}
htmltools::includeMarkdown('Notes.Rmd')
```

非常感谢任何帮助。
这是 Notes.Rmd 文件:

---
title: "Notes"
author: "Homi"
date: "11/10/2020"
output: html_document
---

* Financial time series analysis is concerned with the theory and practice of asset
valuation over time. It is a highly empirical discipline, but like other scientific
fields theory forms the foundation for making inference.  
* Both financial theory and its empirical time series contain an element of
uncertainty.
* Two main reasons to use *returns* instead of *prices*: 1) for average
investors, return of an asset is a complete and scale-free summary of the investment
opportunity. 2) return series are easier to handle than price series because
the former have more attractive statistical properties. There are, however, several
definitions of an asset return.
* From now on assume $P_t$ is the price of the stock at time $t$
* One-Period Simple Return: $$ 1 + R_t = \frac{P_t}{P_t-1} \, \text{or}\ P_t = P_{t-1}(1+R_t) $$
* One-Period Simple Net Return: $$ R_t = \frac{P_t}{P_{t-1}} - 1 = \frac{P_t - P_{t-1}}{P_{t-1}} $$
* Multiperiod Simple Return: $$ 1 + R_t[k] = \frac{P_t}{P_{t-k}} = \prod_{j=0}^{k-1}(1+R_{t-j})$$
* k-period simple net return: $$ R_t[k] = \frac{(P_t - P_{t-k})}{P_{t-k}}$$
* Annualized return: $$ Annualized{R_t[k]} = [\prod_{j=0}^{k-1}(1+R_{t-j})]^{1/k} - 1$$ or $$ Annualized{R_t[k]} = exp[\frac{1}{k}\sum_{j=0}^{k-1}ln(1+R_{t-j})] - 1$$
* Continuous compounding for $m$ periods in a year with $x\%$ interest year per annum for initial investment C: $$ C(1+x/m)^m$$ 
 

【问题讨论】:

    标签: r shiny flexdashboard


    【解决方案1】:

    您可以添加一个 css 块,为您的 section-notes-and-formulaschart-shim 类的 div 添加滚动:

    ```{css my-style, echo = FALSE}
    #section-notes-and-formulas
      .chart-shim {
        overflow-y: scroll;
        }
    ```
    

    【讨论】:

    • 非常感谢,HubertL。它工作得很好。能否推荐一个与 flexdashboard 相关的 CSS 的好学习资料?
    • Firefox web 检查器是你的朋友
    • 非常感谢您的建议
    猜你喜欢
    • 2019-07-02
    • 1970-01-01
    • 1970-01-01
    • 2022-01-14
    • 1970-01-01
    • 2011-07-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多