How I can related menuSubItem to tabPanel - dashboard
I have this app
library(shinydashboard)
library(dplyr)
library(shiny)
mtcars$cyl <- as.factor(mtcars$cyl)
ui <- dashboardPage(
dashboardHeader(title = "Simple Dashboard"),
## Sidebar content
dashboardSidebar(sidebarMenu(
menuItem("Widgets", tabName = "widgets", icon = icon("th")),
menuSubItem("Sub-menu1", icon = icon("dashboard")),
menuSubItem("Sub-menu2", icon = icon("dashboard"))
)),
## Body content
dashboardBody(tabItems(
# First tab content
tabItem(tabName = "widgets",
fluidRow(DT::dataTableOutput('items_dt')))
))
)
server <- function(input, output) {
set.seed(122)
histdata <- rnorm(500)
output$plot1 <- renderPlot({
data <- histdata[seq_len(input$slider)]
hist(data)
})
output$items_dt = DT::renderDataTable(
Patient_005,
filter = 'bottom',
options = list(scrollX = TRUE)
)
}
shinyApp(ui, server)
I also have two data tables like this
Patient_005=as.data.frame(read.table(text = " Driver SNV_Tumour_005 SNV_Organoid_005 INDEL_Tumour_005 INDEL_Organoid_005 Deletion_Organoid_005
ABCB1 * * * - - -
ACVR1B * * - - - -
ACVR2A * - - - - -
"))
Patient_013=as.data.frame(read.table(text = " Driver SNV_Tumour_013 SNV_Organoid_013 INDEL_Tumour_013 INDEL_Organoid_013 Deletion_Tumour_013 Deletion_Organoid_013
ABCB1 * - * - - - -
ACVR1B * - - - - - -
ACVR2A * - - - - - -
"))
I want to have Patient_005 in Sub-menu1 and Patient_013 in Sub-menu2
but only Patient_005 being displayed everywhere generally while I need different patients in different sub menus
Any help please?
Thanks a lot for any help in advance
library(shinydashboard)
library(rAmCharts)
library(plyr)
library(rAmCharts)
library(DT)
library(shiny)
library(shinyBS)
library(highcharter)
library(nycflights13)
library(htmltools)
library(purrr)
library(dbplyr)
library(dplyr)
library(nycflights13)
library(ggplot2)
library(pool)
library(DBI)
library(BBmisc)
library(colourpicker)
library(UpSetR)
library(plyr)
library(gridExtra)
library(d3heatmap)
library(corrplot)
library(Vennerable)
library(wordcloud)
library(nycflights13)
library(shinyHeatmaply)
library(heatmaply)
ui <- dashboardPage(skin = 'yellow',
dashboardHeader(
tags$li(a(href = 'https://www.southampton.ac.uk/medicine/about/staff/tju.page#_ga=2.14695670.1710730763.1560178233-40818463.1486652937',
icon("list-alt"),
title = "Back to Apps Home"),
class = "dropdown"),
tags$li(a(href = 'https://www.southampton.ac.uk/cruk',
img(src = 'https://tse3.mm.bing.net/th?id=OIP.oQOheFA4xY7SFZ5lyJi1nQHaD4&pid=Api&P=0&w=342&h=180',height = 100, width = 100,
title = "Home", height = "30px"),
style = "padding-top:10px; padding-bottom:10px;"),
class = "dropdown")),
dashboardSidebar(
sidebarMenu( img(src = "https://reliawire.com/wp-content/uploads/2018/09/esophogeal-organoid-CinChild.jpg", height = 240, width = 230),
menuItem("Dashboard", tabName = "dashboard", icon = icon("bar-chart-o")),
menuItem("OAC", icon = icon("database"), tabName = "rdb", startExpanded = TRUE,
menuSubItem("005", icon = icon("exclamation-triangle"), tabName = "005"),
menuSubItem("013", icon = icon("exclamation-triangle"), tabName = "013"),
menuSubItem("036", icon = icon("exclamation-triangle"), tabName = "036"),
menuSubItem("121", icon = icon("exclamation-triangle"), tabName = "121")
), menuItem("COAD", icon = icon("database"), tabName = "rdb", startExpanded = TRUE,
menuSubItem("005", icon = icon("exclamation-triangle"), tabName = "005"),
menuSubItem("013", icon = icon("exclamation-triangle"), tabName = "013"),
menuSubItem("036", icon = icon("exclamation-triangle"), tabName = "036"),
menuSubItem("121", icon = icon("exclamation-triangle"), tabName = "121")
)
)
),
dashboardBody(
tabItems(
tabItem("dashboard", fluidRow(
box(
tags$head(tags$link(rel="shortcut icon", href="favicon.ico")),
img(src = 'https://www.cancerresearchuk.org/sites/default/files/styles/cruk_no_style/public/large-icon_alcohol_darkblue_rgb.jpg?itok=q5L2YLuM',height = 500, width = 500),
title = "OAC modeling by Organoid culture", width = 12, status = "primary", tags$li(a(href = 'https://github.com/beginner984/OESO-modelling-by-organoid-culture',
icon("list-alt"),
title = "github"),
class = "dropdown")
),
fluidRow(
box(
title = "Interactive heatmap of deriver genes", width = 4, status = "warning",
p(""),
#p("Using battle option one can generate up-to 9 sets."),
tags$li(a(href = 'https://fi1d18.shinyapps.io/new_folderr/',
icon("list-alt"),
title = "Interactive heatmap"),
class = "dropdown")
),
box(
title = "Jaccard index", width = 4,status = "warning",
p(""),
tags$li(a(href = 'https://fi1d18.shinyapps.io/new_folderrr/',
icon("list-alt"),
title = "Jaccard heatmap"),
class = "dropdown")
)
),fluidRow(
box(
title = "Citation", width = 12, status = "success",
h4("If you use this app, please cite this:"),
HTML("<h5>Underwood T, et al. <a href='' target='_blank'>Shiny app for exploring organoids</a>. </h5>")
)
)
)),
tabItem("005", DT::dataTableOutput("items_dt")),
tabItem("013", DT::dataTableOutput("items_dt1")),
tabItem("036", fluidRow(
tabBox(width = 12, height = NULL,
tabPanel("Organoid 036", fluidRow(
box(
title = "Mutational signature", width = 4, status = "warning",
p(""),
#p("Using battle option one can generate up-to 9 sets."),
img(src='https://github.com/beginner984/OESO-modelling-by-organoid-culture/blob/master/Organoid-image-for-English-banner-stand.png?raw=true', align = "center", height = 350, width = 600)
),
box(
tags$li(a(href = 'https://www.dropbox.com/s/z2j52o9twr9hkzj/036.xlsx?dl=0',
icon("list-alt"),
title = "Patient details"),
class = "dropdown")
)
)
),
tabPanel("Data", value=2,
fluidRow(
valueBoxOutput("vbox1", width = 2),
valueBoxOutput("vbox2", width = 2),
valueBoxOutput("vbox3", width = 2),
valueBoxOutput("vbox4", width = 8),
valueBoxOutput("vbox5", width = 2),
valueBoxOutput("vbox6", width = 2),
valueBoxOutput("vbox7", width = 2),
valueBoxOutput("vbox8", width = 2)
),
fluidRow(
column(width = 4, tags$li(a(href = 'https://fi1d18.shinyapps.io/new_folder/',
icon("question"),
title = "Interactive heatmap"),
class = "dropdown"), box(title = "76 deriver genes from Frankel paper", width = NULL, solidHeader = FALSE, dataTableOutput("dat1"))),
column(width = 4, box(title = "Annotated SNVs and INDELS", width = NULL, solidHeader = FALSE, dataTableOutput("dat2"))),
column(width = 4, box(title = "Structural variants", width = NULL, solidHeader = FALSE, dataTableOutput("dat3")))),
fluidRow(
column(width = 4, box(tags$li(a(href = 'https://github.com/beginner984/OESO-modelling-by-organoid-culture/blob/master/example.png?raw=true',
icon("image"),
title = "Structural variants"),
class = "dropdown") ), img(src='https://github.com/beginner984/OESO-modelling-by-organoid-culture/blob/master/example.png?raw=true', align = "center", height = 100, width = 100), p("Structural variants")),
column(width = 4, box(tags$li(a(href = 'https://github.com/beginner984/OESO-modelling-by-organoid-culture/blob/master/Untitled.png?raw=true',
icon("image"),
title = "Structural variants"),
class = "dropdown") ), img(src='https://github.com/beginner984/OESO-modelling-by-organoid-culture/blob/master/Untitled.png?raw=true', align = "center", height = 100, width = 100), p("Total and minor copy number (purple/blue respectively)")),
column(width = 4, box(tags$li(a(href = 'https://github.com/beginner984/OESO-modelling-by-organoid-culture/blob/master/1.png?raw=true',
icon("image"),
title = "Structural variants"),
class = "dropdown") ), img(src='https://github.com/beginner984/OESO-modelling-by-organoid-culture/blob/master/1.png?raw=true', align = "center", height = 100, width = 100), p("Major and minor copy number (red/green respectively)")),
column(width = 4, box(tags$li(a(href = 'https://github.com/beginner984/OESO-modelling-by-organoid-culture/blob/master/2.png?raw=true',
icon("image"),
title = "Mutational consequences"),
class = "dropdown") ), img(src='https://github.com/beginner984/OESO-modelling-by-organoid-culture/blob/master/2.png?raw=true', align = "center", height = 100, width = 100), p("Mutational consequences"))
)
)
)
)),tabItem("121", DT::dataTableOutput("items_dt2"))
)
)
)
server <- function(input, output) {
output$items_dt = DT::renderDataTable(
Patient_005,
filter = 'bottom',
options = list(scrollX = TRUE)
)
output$items_dt1 = DT::renderDataTable(
Patient_013,
filter = 'bottom',
options = list(scrollX = TRUE)
)
output$dat1 <- renderDataTable(derivers,
filter = 'bottom',
options = list(scrollX = TRUE))
output$dat2 <- renderDataTable({datatable(annotated_snv_indel,extensions = 'Responsive' )})
output$dat3 <- renderDataTable(structural_variants,
filter = 'bottom',
options = list(scrollX = TRUE))
output$items_dt2 = DT::renderDataTable(
Patient_021,
filter = 'bottom',
options = list(scrollX = TRUE)
)
}
shinyApp(ui, server)
Related
Is it possible to round the edges of a row in jetpack?
This is what I'm trying to achieve: So I have created 2 rounded buttons in a row and gave different background colors depending whether they're selected or not. The goal is to create a kind of an illusion of a tab/toggle. The unselected button will have the same color as the row's background color. Unfortunately, since a row is a rectangle shape there comes a residue space at the corners that still shows the background color . This is my code for the buttons val cornerRadius = 20.dp var selectedIndex by remember { mutableStateOf(0)} val configuration = LocalConfiguration.current val screenWidth = configuration.screenWidthDp.dp val items = listOf( OutlinedButton(onClick = { /*TODO*/ }) { }, OutlinedButton(onClick = { /*TODO*/ }) { }) Row( modifier = Modifier .padding(top = 8.dp) .wrapContentHeight() .width(screenWidth).background(color = Color.Gray).clip(shape = RoundedCornerShape(20.dp)) ) { // Spacer(modifier = Modifier.weight(1f)) items.forEachIndexed { index, item -> OutlinedButton(modifier = Modifier .wrapContentHeight() .width(screenWidth/2), shape = when (index) { // left outer button 0 -> (if (selectedIndex == index) { RoundedCornerShape( topStart = cornerRadius, topEnd = cornerRadius, bottomStart = cornerRadius, bottomEnd = cornerRadius ) } else { RoundedCornerShape( topStart = cornerRadius, topEnd = cornerRadius, bottomStart = cornerRadius, bottomEnd = cornerRadius ) }) //rightouterbutton else -> (if (selectedIndex == index) { RoundedCornerShape( topStart = cornerRadius, topEnd = cornerRadius, bottomStart = cornerRadius, bottomEnd = cornerRadius ) } else{RoundedCornerShape( topStart = 0.dp, topEnd = cornerRadius, bottomStart = 0.dp, bottomEnd = cornerRadius )}) }, border = BorderStroke( 1.dp, if (selectedIndex == index) { Color.Transparent } else { Color.Transparent } ), colors = if (selectedIndex == index) { // colors when selected ButtonDefaults.outlinedButtonColors( backgroundColor = Color.Yellow, contentColor = Color.Black ) } else { // colors when not selected ButtonDefaults.outlinedButtonColors( backgroundColor = Color.Gray, contentColor = Color.Black ) }, onClick = { selectedIndex = index }, ) { if (index == 0) { Text( text = "In progress", color = if (selectedIndex == index) { Color.Black } else { Color.DarkGray.copy(alpha = 0.9f) }, modifier = Modifier.padding(horizontal = 8.dp) ) } else { Text( text = "Completed", color = if (selectedIndex == index) { MaterialTheme.colors.primary } else { Color.DarkGray.copy(alpha = 0.9f) }, modifier = Modifier.padding(horizontal = 8.dp) ) } } } }
Modifier.clip applied after the Modifier.background has no effect in your case, you need to reverse the order. Read more about why the order of modifiers matters in this answer .clip(shape = RoundedCornerShape(20.dp)) .background(color = Color.Gray) Another option in the case of Modifier.background is that you can apply the shape specifically to the background color. Note that this solution will not clip other view content to the shape as Modifier.clip does, but in your case it fits. .background(color = Color.Gray, shape = RoundedCornerShape(20.dp))
How to make a PUT/PATCH request with ListField field in Django-REST?
I am trying to build a rest-api for a movie-review website. The movie model contains a cast-field which is a list-field, when using ModelViewSets one can't POST ListFields through HTML, so I set blank = true for all list-fields thinking that I'll make a raw PATCH request to update the blank fields, but I am unable to do so. models.py class Movie(models.Model): movie_name = models.CharField(max_length = 100, unique = True) release_date = models.DateField(blank = True) description = models.TextField(max_length = 500) movie_poster = models.ImageField(blank = True) directors = ListCharField( base_field = models.CharField(max_length = 500), max_length = 6 * 500, blank = True ) trailer_url = models.URLField() cast = ListCharField( base_field = models.CharField(max_length = 225), max_length = 11 * 225, blank = True ) genre = ListCharField( base_field = models.CharField(max_length = 225), max_length = 11 * 255, blank = True ) avg_rating = models.FloatField(validators = [MinValueValidator(0), MaxValueValidator(5)]) country = models.CharField(max_length = 100) language = models.CharField(max_length = 100) budget = models.BigIntegerField(blank = True) revenue = models.BigIntegerField(blank = True) runtime = models.DurationField(blank = True) Serializer class MovieSerializer(ModelSerializer): cast = ListField( child = CharField(required = False), required = False, min_length = 0 ) genre = ListField( child = CharField(required = False), required = False, min_length = 0 ) directors = ListField( child = CharField(required = False), required = False, min_length = 0 ) class Meta: model = Movie fields = '__all__' I used djano-mysql for adding the ListCharField field-type. https://i.stack.imgur.com/sC6Vw.png [The data without list field values] https://i.stack.imgur.com/W3xea.png [request I tried to make] https://i.stack.imgur.com/OPeJn.png [response that I received]
Original put request which resulted in an error response https://i.stack.imgur.com/W3xea.png The request had some trailing commas, due to which the API expected more values. Here's the correct request-content - { "cast": [ "aamir", "sakshi" ], "genre": [ "biopic" ], "directors": [ "nitesh tiwari" ] }
how image size dynamic report stimulsoft mvc core
iam add image to sitmul desinger i want set setting dynamic resize and cangrow . also change size page report to a5 or a4.. how slove this problem iam try google serach but dont result. #Html.StiNetCoreViewer(new StiNetCoreViewerOptions() { //Width = Unit.Pixel(794), //Height = Unit.Pixel(1123), //setPageFormat(200, 500, PageOrientation.PORTRAIT), Theme = Stimulsoft.Report.Web.StiViewerTheme.Office2013WhiteBlue, Localization = "Localization/fa.xml", Actions = { GetReport = "Print", ViewerEvent = "ViewerEvent", }, Appearance = { RightToLeft=true, PageAlignment=Stimulsoft.Report.Web.StiContentAlignment.Center, BackgroundColor = System.Drawing.Color.White, PageBorderColor = System.Drawing.Color.Blue, ShowPageShadow = true, ScrollbarsMode = true, // InterfaceType = Stimulsoft.Report.Web.StiInterfaceType.Auto }, Exports = { ShowExportToDbf = false, ShowExportToDif = false, ShowExportToHtml= false, ShowExportToPowerPoint=false, ShowExportToCsv=false, ShowExportToDocument = false, ShowExportToExcel2007= false, ShowExportToImageBmp=false, ShowExportToRtf=false, ShowExportToImageSvgz=false, }, })
hi iam sloved this problem foreach (StiPage page in report.Pages) { page.Orientation = StiPageOrientation.Portrait; page.Margins.Top = 0; page.Margins.Bottom = 0; page.Margins.Left = 0; page.Margins.Right = 0; page.PaperSize = System.Drawing.Printing.PaperKind.A4; } StiReport report = new StiReport(); var image = report.GetComponentByName("Image1") as StiImage; image.CanGrow =false ; image.Width = 120;
Eclipse RCP widgets don't resize based on the systems font size
Using GridLayout and GridData, everything is sized correctly in my Eclipse RCP application. The problem occurs when I change the default Windows font to a larger size than the normal. In that case, RCP will not take into account also the font size (it renders everything as if the font was normal sized). Hadn't find any working solution so far. Example code: #Override protected Control createDialogArea(Composite parent) { GridData gridData; Composite newContainer; newContainer = new Composite(parent, SWT.NONE); gridData = new GridData(GridData.FILL, GridData.FILL, true, true); newContainer.setLayoutData(gridData); mainLayout = new GridLayout(2, true); mainLayout.marginHeight = 5; mainLayout.marginWidth = 5; mainLayout.marginLeft = 5; mainLayout.marginRight = 5; mainLayout.horizontalSpacing = 15; mainLayout.verticalSpacing = 10; newContainer.setLayout(mainLayout); taskNameLabel = new Label(newContainer, SWT.LEFT); taskNameLabel.setText(Messages.LABEL_TASK_NAME); gridData = new GridData(SWT.FILL, 0, true, true, 1, 1); taskNameLabel.setLayoutData(gridData); taskNameText = new Text(newContainer, SWT.LEFT | SWT.BORDER); gridData = new GridData(SWT.FILL, 0, true, true, 1, 1); taskNameText.setLayoutData(gridData); commentsLabel = new Label(newContainer, SWT.LEFT); commentsLabel.setText(Messages.LABEL_COMMENTS); gridData = new GridData(SWT.FILL, 0, true, true, 1, 1); commentsLabel.setLayoutData(gridData); commentsText = new Text(newContainer, SWT.LEFT | SWT.BORDER | SWT.V_SCROLL | SWT.MULTI | SWT.WRAP); gridData = new GridData(SWT.FILL, 0, true, true, 1, 1); gridData.heightHint = 100; commentsText.setLayoutData(gridData); SwtTextUtil.allowTabOnMultiText(commentsText); durationLabel = new Label(newContainer, SWT.LEFT); durationLabel.setText(Messages.LABEL_DURATION); gridData = new GridData(SWT.FILL, 0, true, true, 1, 1); durationLabel.setLayoutData(gridData); durationSpinner = new Spinner(newContainer, SWT.LEFT | SWT.BORDER | SWT.WRAP); durationSpinner.setDigits(1); durationSpinner.setMinimum(1); durationSpinner.setMaximum(PipetteConstants.MAX_BEEPER_DURATION_DS); durationSpinner.setSelection(1); durationSpinner.setIncrement(1); gridData = new GridData(SWT.FILL, 0, true, true, 1, 1); durationSpinner.setLayoutData(gridData); SpinnerUtil.get().addSpinnerValidation(durationSpinner, PipetteConstants.MAX_BEEPER_DURATION_S, 0.1); displayTextLabel = new Label(newContainer, SWT.LEFT); displayTextLabel.setText(Messages.LABEL_DISPLAY_TEXT); gridData = new GridData(SWT.FILL, 0, true, true, 1, 1); displayTextLabel.setLayoutData(gridData); displayTextText = new Text(newContainer, SWT.LEFT | SWT.BORDER | SWT.MULTI); gridData = new GridData(SWT.FILL, 0, true, true, 1, 1); gridData.heightHint = 50; displayTextText.setLayoutData(gridData); SwtTextUtil.allowTabOnMultiText(displayTextText); requiredLabel = new Label(parent, SWT.LEFT); requiredLabel.setText(Messages.LABEL_REQUIRED); gridData = new GridData(SWT.RIGHT, 0, false, false, 2, 1); requiredLabel.setLayoutData(gridData); return newContainer; } Although font size is changed when I read the height of the font, it is the same as when using normal sized fonts - is this maybe a bug, where getHeight() method of a getFontData() method of the font object returns wrong information, which in turn RCP uses for its widget layout/positioning? getShell().getDisplay().getSystemFont().getFontData()[0].getHeight() and newContainer.getFont().getFontData()[0].getHeight() both return 9, no matter the size of the fonts on the windows, although the fonts do change their size.
Visifire.Charts How to disable vertical lines. WP
Chart is created by code. But I can't disable vertical lines in chart. It is a code of creating chart: public void CreateChart() { CleanChart(); visiChart = new Chart() { ToolTipEnabled = true, Width = 400, Height = 200, Padding = new Thickness(0), Margin = new Thickness(0, 6, 0, -12), Background = new SolidColorBrush(Colors.White), }; ChartGrid grid = new ChartGrid() { Enabled = false }; DataSeries dataSeries = new DataSeries(); DataPoint dataPoint; Axis yAx = new Axis() { AxisLabels = new AxisLabels() { Enabled = false }, Grids = new ChartGridCollection() {grid} }; int i = 0; var deps = App.CurrentAgreement.Deposits.Deposit.Where(x => x.DepositIliv + x.DepositLink > 0).ToList(); foreach (var dep in deps) { dataPoint = new DataPoint(); dataPoint.YValue = dep.DepositIliv + dep.DepositLink + dep.UValue + dep.WarrantyValue; dataPoint.XValue = i; i++; dataPoint.LabelText = dataPoint.YValue.Out(); dataPoint.AxisXLabel = DateTime.Parse(dep.DepositDate).ToString("MMM yyyy"); dataPoint.MouseLeftButtonUp += dataPoint_MouseLeftButtonUp; dataSeries.DataPoints.Add(dataPoint); } dataSeries.LabelEnabled = true; dataSeries.RenderAs = RenderAs.Column; dataSeries.Color = new SolidColorBrush(Colors.Green); visiChart.Series.Add(dataSeries); visiChart.AxesY.Add(yAx); ChartPlaceHolder.Children.Add(visiChart); } But i dont need vertical lines visible. It is a screen of chart. How i can disable lines?? Help me, please.
You have to disable the Grid lines from AxisX also. Example: ChartGrid grid = new ChartGrid() { Enabled = false }; Axis xAx = new Axis(); xAx.Grids.Add(grid); visiChart.AxesX.Add(xAx);