R shiny sliderInput show time - r

I have a question related to the sliderInput in R shiny.
In the sliderInput, the value is a number. Some examples show that the number is $number. However, if I want to show the value of sliderInput as a time, say 10:00, 15:00, how should I do it?
Thanks a lot.

This is a partial answer, giving you some pointers that anyone with some JS knowledge can use. To the best of my knowledge, as of Shiny-0.5, you can achieve this only by writing some Javascript/JQuery.
If you are able to incorporate JQuery plug-ins into your UI.R Shiny app, this link has what you want.
Use CSS style to make sure that the SliderInput labels get formatted the way you want. (Showing Date/Time as opposed to numbers.) I typically put any tags$head() styling code inside SideBarPanel() and it has worked.
You will also need a Javascript function that takes in the input$number and returns a valid date/time. Link with code: This JQuery post has a javascript function that you should be able use (with DatePicker)
Hope that helps.

Related

How to expand all steps in Material UI stepper for printing page?

I am working on a React component that makes use of Material UI stepper.
The requirement is that the data has to be printable as well. When you print though, all the steps should be expanded and have to be printed. This is against the default behaviour of a stepper. #media print does not seem to work as the Stepper is controlled with 'active' attribute to toggle display and not just CSS class. Has anyone achieved this before? Material UI components with different behaviour for printing only? Let me know thanks.
Basic stepper example - https://codesandbox.io/s/rm5713kkln
Recently I had a project with the same requirements and couldn't find any solution with react component level.
However, I could find a solution from redux store level. (If you are using a store).
I added my multi-step form into a redux form (https://redux-form.com/7.4.2/) [btw you can do this without the redux form library]
then the data added into the store was retrieved to a final summary page. (final step of stepper)
since the summary page has all the data I could use this data with jsPDF (like client-side PDF generator)[https://mrrio.github.io/]
finally, I found this approach was way cleaner than using the HTML into pdf since I can change and improve the look and UI of the pdf as I wish. (it doesn't depends on the HTML UI, only on the data)
hope this will help you.

Use a template image in Shiny

I'm looking for a way in Shiny to allow a user to change the values for (a) and (d) and update the rest of the confusion matrix. The key is that I'd like the text and numbers to appear in this visual format. Is there any way to use a template image and overlay objects that get updated dynamically? A better approach?
We have this so far, but the layout is not ideal.

What advantages does the new ion.RangeSlider bring to Shiny?

As of Shiny 0.11, the sliders have been changed to ion.RangeSlider.
At first glance, they look very different, especially with the HTML 5 skin:
...but apparently these new sliders can do (a lot?) more than the old sliders.
I'd like to take advantage of the new ion.RangeSlider, especially features like updateSliderInput, which wasn't working for me with the old sliders.
However, I can't seem to find any documentation on how to actually take advantage of what the new slider has to offer.
The documentation on the slider looks the same as it did prior to 0.11.
RStudio says the new sliders "support updating more properties from the server..."
My question is, what exactly are the properties that are supported?
Further, it looks like there are some skins that can change the appearance of the slider -- are these skins available out of the box when using Shiny?
For example:
I would love to use this skin -- suddenly the difference between the old slider and new slider is not so drastic.
Thanks.
I think they decided to change to ion.rangeslider because it's much more powerful and supports a lot more features, but as you noticed, they haven't taken advantage of any of those features.
All the settings (https://github.com/IonDen/ion.rangeSlider#settings) can be changed within JavaScript, so the slider is technically already more powerful than before, but you're right that the Shiny functions need to be updated to make it more convenient to use these settings/features.
There's an open issue on github for exactly this problem, and they recently added the milestone of shiny 0.12.2 to it (https://github.com/rstudio/shiny/issues/866)
Regarding skins: by looking at the documentation, it says that you need to include a special CSS file for each one of the skins they provide

How to display verbatim code in R shiny?

I'm currently using helpText in my ui.R file to display some static code content. However, because the output is not fixed width, the code looks like a mess. So how to display verbatim code; fixed width so it's easy to read?
I'm not sure I understand the problem, but the first solution would be renderVerbatim. If that doesn't cut it, you could look at ShinyAce, though that may be overkill for what you need; if does have nice features like syntax highlighting for R, though.
I believe this is highly related to a related Shiny question about rendering multiple lines of text at once:
Outputting multiple lines of text with renderText() in R shiny
At least, the main answer there is one way to solve this problem.

Create graph in ASP based on the values from database

does anyone know how to create a bar/pie graph based on the value from database in ASP? For example, i would to create a graph based on the number of people who went for vacation in certain state..I would like to retrieve the value directly from database..need help..thanks..
You could check out Google Charts.
There are a number of great javascript libraries which can take datasets and convert them into graphs.
canvasgraph
flot
are two of the big ones. The plus of javascript is that the processing is done client side and you don't have to send over images, just JSON.
Dojo also works well, though documentation is a little scarce.
Microsoft's Office Web components (OWC11) also works on the server side, and it's fairly easy to use.
Third option is to use plain old HTML. Works well sometimes if you want a simple chart, like a horizontal bar chart. You can use a table, with div / span tags set to correct widths ad colors for the bars. Free, easy and requires no plugins of any kind to work.

Resources