Multiple plots side by side in a Shiny app - r

I have previously created apps where the plots were placed side by side by using the width attribute. However, for this new app it doesn't work, and I can't seem to find the reason why.
Previous app where it works, live version. GitHub repo. Or run using (load Shiny library first):
runGitHub("deleetdk/regression_towards_the_mean")
The new app where it doesn't work. GitHub repo. Or run using:
runGitHub("deleetdk/classification_multiple_predictors")
The relevant code looks identical to me. What am I overlooking?

The app where it works uses custom CSS to set float:left: https://github.com/Deleetdk/regression_towards_the_mean/blob/master/www/style.css
https://github.com/Deleetdk/regression_towards_the_mean/blob/master/ui.R#L13

Related

multiple pages are overlapping in ngx-extended-pdf-viewer

I am using ngx-extended-pdf-viewer for my angular app and looks like multiple pdf pages are overlapping during viewing. here is my viewer code
<ngx-extended-pdf-viewer
*ngIf="isVisible"
[src]="pdfData"
useBrowserLocale="true"
[textLayer]="true"
[showPrintButton]="true"
[showDownloadButton]="true"
[showOpenFileButton]="false"
[showBookmarkButton]="false"
[showPresentationModeButton]="false"
height='90%'
[zoom]="'100%'">
</ngx-extended-pdf-viewer>
I tried setting stylesheets for page and viewer classes but no luck.
Sounds like you've got CSS rules interfering with the CSS rule of ngx-extended-pdf-viewer. Create a greenfield project to check if it's a general problem:
Open a terminal and navigate to the root folder of your project.
Run this command and accept the defaults:
ng add ngx-extended-pdf-viewer
Add the new component <app-example-pdf-viewer> to your <app-component> to display the PDF file.
Now you've got a working project that almost certainly does not suffer from your bug. Use the developer tools of your browser to compare the CSS code of the two projects to hunt down the bug.

Different CSS displayed between Dev environment and Production environment for website with same code

For the following website that I have made: ifrs.site (WordPress site with custom theme, if that's important), there is an overlap of content by the footer when the browser window is not maximised on desktop, or when viewed on mobile. I fixed this overlap issue in the dev environment, but the live website with the same CSS code as the dev website ends up with a worse overlap.
What is the cause in discrepancy? You can see the differences in code at this github repo: https://github.com/keg504/IFRS-Website-theme-files, in the 2 branches dev-files and master. What is on master is what is used on the site currently.
I'm using Local by Flywheel for the dev environment on Windows 10, and the CSS is run using a webpack configuration on nodejs.
Edit: As Aliqua has requested, I've added the wp_enqueue_style function I'm calling to load the CSS: wp_enqueue_style('our-main-styles', get_theme_file_uri('/bundled-assets/styles.ba56d060f11656536bc3.css'));
The part between styles...css changes whenever npm run build is run in the command line
Depending on your design/setup the css could have attached in the source code a ?ver=1.0.0 or similar. Which means if you have made changes but not updated the version it is still recalling the original file from the cache.
Some developers overcome this by setting the enqueue_script() version part of the array to a date() (including time with hour-min-sec) function. This will mean that everytime the page is refreshed the version is different and it wont recall older versions of the css from the cache.
Search your code for the enqueue script line for the css in question and see if you can set date() to the version value.
Refer to https://www.php.net/manual/en/function.date.php for more information.
Update:
Based on your update, you could replace it with something like this.
wp_enqueue_style( 'our-main-styles',
get_theme_file_uri('/bundled-assets/styles.ba56d060f11656536bc3.css'),
array( $parent_style ), // remove if there is no parent style
date("His")
);
Reference wp_enqueue_style - https://developer.wordpress.org/reference/functions/wp_enqueue_style/
Final Thoughts:
Please note, that this answer may in fact not be the actual solution as much as I have tried to identify your issue. Please refer to https://developer.wordpress.org/ to familiarise yourself with the introductory information in relation to wordpress development. If you are going to want to do more changes to your wordpress CMS, you will need a basic understanding of how to make changes. Please focus some of your research to plugin creation, working with child themes, and how to make your own custom functions. Then you will be able to write better questions, and be able to action the answers in the future.
Best of luck with your development.

Flexdashboard on shinyapp.io with embedded images [R]

I have an R flexdashboard that runs with shiny and although I have managed to host it on shinyapp.io, I cannot get images to render. I understand that normally, with a Shiny app, I would need to place the images in a 'www' folder. But with a flexdashboard there is no associated folder like that. How would I go about getting the images to load on shinyapp.io? Images show up completely fine when I run the flexdashboard locally.
It's ok to put your images in a www folder. Make sure to reference the path. Example markdown text:
Built with ![](www/shiny_50.png).
I was having problems rendering that image until I discovered that its original resolution was too large to fit in the chart window. I used the Magick package to resize.

Image not showing in Shiny app R

I have an image i'd like to embed into my shiny app, and have read as much as I can find on how to do it. Although, all I get is a blue question mark when I run my code.
This is the line of code I have added, within the fluidPage ui command
img(src="logo.png", align = "right",height='100px',width='400px')
My image has been placed in the project directory folder, as well as trying in a separate folder inside named www (as per suggestion given here)
EDIT: Code used in the following context:
ui <- fluidPage(titlePanel("Test title"),
img(src="logo.png", align = "right",height='100px',width='400px'),
hr())
After coming back to this problem, I found that the solution is to simply format the Shiny code properly, by naming the R file app.R, and clicking Run App as opposed to selecting all of the code and running within the console.
Not sure how or why this makes a difference, but the numerous Shiny applications I have worked on since have all been resolved when doing this.
Just a note that may be helpful to someone else, it just happened to me: please double check if your app.R is in the root directory. I.e, app.R is on the same level as the www folder. I know it seems trivial, but if you (as I just did) put app.R into a subfolder and click Run App, the app can still run, just without the pictures.
I was having the same problem. To solve this, just create a folder named 'www' in the same folder as your app.R script and put the images within that folder.
I found the solution to this problem in the tutorial video in this page: Shiny Tutorial Video - Adding Static Content
Watch from 1h45min00sec.
You should check if the name of your R code file is called “app.R" instead of called xxx.R. this error also happened to me

How to change JavaFx native Bundle exe icon

I am trying to chance the icon of the exe file created native bundling of javafx packaging but it still contains the default icon. Please suggest
primaryStage.getIcons().add(FileUtility.loadImage("icon.png"));
did not help, it only changes the title bar and task bar icon.
The ico file still gets generated and icon of the exe files remains the default one
I also tried to assign an icon in the project properties-> Deployment-> icon but did not help
I believe I have encountered the same issue and the solution is described in the following thread.
As a side note - neither specifying your icon in the build.xml file or via the project's options in the deployment section is going to work thus far, but it seems to be fixed in the upcoming release of 7u10.
I added response here How to set custom icon for javafx native package icon on Windows and thinks it is the same issue you started out with. However you seem to have moved on, but others might find it interesting...
I added src/main/deploy/package/windows/myapp.ico there and it finally worked :)
For you:
Create src/main/deploy/package/windows/ folder
Add icon with name ${project.build.finalName}.ico
Run mvn jfx:build-native
I haven't played with it extensively - just got it to work and wanted to share. So if you want to use icon with different name, I don't know how. Not yet at least. The ... section in the config section seems to be for webstart, so I haven't been using it. Hope you get it to work!
Answered at How to set custom icon for javafx native package icon on Windows

Resources