I have embedded animated plot sample into a web page, that works fine. After restarting the animated.py plot script the bokeh_modelid="71dcea49-64c3-42d3-bac1-373f780fe2fd" keeps changing, so I need to modify the embed script part in HTML.
How to get bokeh_modelid="XYZ" point to a fix string, so embed script doesn't have to be modified each time animated script is restarted?
<html>
<body>
<h2>Simple Embed Example</h2>
<p>Here is my plot:</p>
<p>
<script src="http://localhost:5006//bokeh/embed.js"
bokeh_plottype="serverconn" bokeh_docid="3980adc2-f1c8-4207-906b-dde7d636ac82"
bokeh_ws_conn_string="ws://localhost:5006/bokeh/sub"
bokeh_docapikey="43274608-8c07-4d76-9d57-df2da7d14212"
bokeh_root_url="http://localhost:5006/"
bokeh_modelid="71dcea49-64c3-42d3-bac1-373f780fe2fd"
bokeh_modeltype="Plot" async="true"></script>
</p>
The problem here is that new model is created each the animated.py is restarted.
Answers and suggestions to this question are at Bokeh forum:
https://groups.google.com/a/continuum.io/forum/#!topic/bokeh/Rt7UCnCyHrA
Related
My site is using Angular 10 (With server side rendering). I referred to https://angular.io/guide/universal to convert the site into SSR. Everything is working fine. 'View Source' shows me the content, I can share with Social Media. My node server does not give me any error.
The only issue I am facing is - When it is rendered through the node server, it shows as HTML string. For few seconds user sees below:
<!DOCTYPE html> <html> <head> </head> <body> <h3>Step 1 - Add environment variable </h3> <p> ......</p> </body> </html>
Later it switches back to properly formatted HTML. The same is the case with material icons used on site. I see them as strings initially.
Please check out the link https://ecokrypt.com/dashboard/article/detail/5e59df2b00190207e65d9e99/4.3---Angular%253A-Consider-Different-Environments
Slow network throttling shows the issue clearly. This is giving a very bad end-user experience. Am I missing any step in SSR? How can I handle this? I tried to search this issue on google, but no luck.
I am struggling to embed leaflet map created R into my github account
The file exported into single HTML file and I can view it on my computer
When I upload and then open from github, it gives raw HTML code, not the interactive map
And I'm not even sure how to embed this interactive map in ReadMe.md. When I place the link to the html and click it, I get the same raw map.
Help!
Update
I created follow-up question, If HTML doesn't work well in github, how can some people make it work
You can prepend http://htmlpreview.github.io/? to the url of where you put the html file. In your case:
http://htmlpreview.github.io/?https://github.com/Sonihal/yorbalinda_interactive_map/blob/master/web_Yorba_Linda.html
Just in case anyone is still looking for a solution, I wrote a post explaning how to do it, assuming that you use Jekyll to build your website hosted on GitHub.
https://dieghernan.github.io/201905_Leaflet_R_Jekyll/
In short,you have to perform several steps:
On GitHub/Jekyll
Identify the code you need to include. I already did it for you See on my GitHub
Copy/paste it in the code that builds your <head>. This would depend on your Jekyll implementation. After doing that, the needed libraries would be loaded every time that Jekyll builds the website.
On Rstudio
Create a map with leaflet and knit it to a github_document. It is important to knit it using always_allow_html: yes in the front matter.
On Markdown
Check that every leafletmap has produced an html code in the .mdfile. Something like this:
<!--html_preserve-->
<script type="application/json" data-for="htmlwidget-SOMEIDNUMBER">
{"x":{"options": ...
<!--more funky code here-->
Paste this chunk before the <script> part:
<div id="htmlwidget-SOMEIDNUMBER" style="width:100%;height:216px;" class="leaflet html-widget"></div>
So you got something like this for each leaflet map:
<!--html_preserve-->
<div id="htmlwidget-SOMEIDNUMBER" style="width:100%;height:216px;" class="leaflet html- widget"></div>
<script type="application/json" data-for="htmlwidget-SOMEIDNUMBER">
{"x":{"options": ...
<!--more funky code here-->
Now publish it on GitHub. Now when Jekyll builds your blog/web hosted on GitHub the libraries are loaded and the leaflet map displays correctly. Note that on local or markdown the map is still not visible.
Once that you have done it a couple of times you will see that is basicaly copy/paste/modify the chunk that I presented on step 5.
I'm a very unexperienced programmer. I've been doing codeacademy javascript track but I found out that you need to put javascript in an HTML file? I want to make sure that I can write basic javascript before continuing on code academy so I downloaded brackets and when I tried to test my program with the live preview feature it said, "Open an HTML file or make sure there is an index.html file in your project in order to launch live preview. I typed this up very quickly so there are probably plenty errors but here is the code if that helps answer my question.
<!DOCTYPE html>
<html>
<body>
<h1> Daily Programmer Challenge 12/15/14 </h1>
<script type = "text/javascript">
var volume = prompt ("Enter the volume of the container that you wish to make");
var cube = math.pow(volume, 1/3);
window.document.write("The size of the container is '+cube+' width, '+cube+' high, and '+cube+' tall");
</script>
</body>
</html>
save this code that you pasted as a file called index.html and then try Bracket's live preview.
For everyone, this problem can be resolved by following steps:-
On menu bar, go to File --> Open Folder (folder which have your html file for live preview)
Select Folder
Select your html file from left side bar for live preview
Click on bolt icon on right (preview button)
All it melts down to the fact, that you need that folder(which have your file) selected to view your output in live preview.
Let me know, if it helps someone. :)
I want to put a HTML link (actually it redirects to file://...) on the R Shiny user interface, so that end-users can just click it and go to that page in another tab in Chrome. Is there a way to do that? Where shall I put? In the ui.R file or in the server.R file?
I find a post here: http://www.r-bloggers.com/more-explorations-of-shiny/ but I am not sure how to use the a() function...
Note: I know how to do that (see my comments below), but since I am redirecting to a file:// destination, the link won't work. Any solutions?
Thanks!
Something like this should work:
doc <- tags$html(
tags$body(
a(href="http://www.lalala.com"))
)
cat(as.character(doc))
<html>
<body>
</body>
</html>
I've seen this question asked in pieces (just JS or just CSS) on other sites and SO, but I haven't seen a good solid way to do this yet.
My situation is fairly common. I'm using .NET MVC and developing in Visual Studio. I have a Site.Master page and multiple views, each with a content placeholder where I specify my JS and CSS files, like this:
<asp:Content ID="headerContent" ContentPlaceHolderID="HeaderContent" runat="server">
<link href="../../CSS/example.css" rel="stylesheet" type="text/css" />
<script src="../../JS/jquery/jQueryFile.js" type="text/javascript"></script>
<!-- More files here -->
</asp:Content>
And my navigation bar is a sprite image, similar to the one seen on Apple's website. I have site sections with headers, also similar to Apple's, that are images. So my site isn't extremely image-heavy, but especially when I view in IE (but also Firefox, to some extent), the site sort of pieces itself together before my eyes, while it loads the images and jQuery files for plugins (datatables plugin always takes a second to apply to my tables).
I'd rather not show the page at all until all images, CSS, and JS files have loaded. A nice progress bar, or even an animated GIF would suffice to show before I show them the final site, all loaded. I think Gmail's loading bar uses this same idea.
Are there any suggestions on how best to achieve this? Thanks very much.
Try this: http://bytes.com/topic/javascript/answers/512734-how-make-progress-bar-while-browser-loading-page
I've not tried this out yet, give it a cautious try. Inside $(document).ready, create an overlay that displays a loading icon, like an animated circle sorta thing. I'll assume you'll name it #overlay.
Then, outside of $(document).ready, try this
$(window).load(function(){
$("#overlay").hide();
});
$(window).load means everything is ready: http://4loc.wordpress.com/2009/04/28/documentready-vs-windowload/