Is google chart supported in Preact? - preact

I am trying to complete my application in preact. I am running into an issue now, I can't display and update google donut chart with data from preact. Is this possible? Can I use react-google-chart package in preact?

Related

How do I dynamically set Chrome Extension Icon based on an image from a different URL

Currently I am migrating my MV2 chrome extension into MV3.
With my MV2 extension, I can dynamically set my extension's icon using an image from a remote url using a code similar to the answer of this stackoverflow topic : Chrome Extension: Icon from URL
With the introduction of manifest-v3 and service workers, the service worker lost access to the DOM, making calls to creating instances of Image and canvas impossible.
My MV3-extension is now using nodeJS. I was looking into a combination of JSDOM, node-canvas, and OffScreenCanvas to implement the original code but no success as of yet.
What would be the best approach to set the icon dynamically (chrome.actions.setIcon), based on an image remotely hosted?
Thank you very much.
This was answered by wOxxOm in the comments for anybody looking into this same issue.
createImageBitmap + OffScreenCanvas can be successfully used in a service worker, no need for JSDOM or any external libraries.

Is it possible to embed/stream/project the live image of a native Windows window into a webpage?

In the new Microsoft Flight Simulator you can pop different cockpit displays out into their own external windows, like this:
However, none of the buttons needed to interact with the displays get "popped out" as well.
I'd like to build a web app that can embed (the continuously updating image of) one of these windows that I can surround with buttons, etc, for interaction to have, say, running on a tablet next to you.
My question is, is it possible with Node to embed the continuously updating image of a native Windows window within a webpage?
Stumbled upon the Screen Capture API. This is what I was looking for.
https://developer.mozilla.org/en-US/docs/Web/API/Screen_Capture_API

Altair Offline Rendering

How can I create interactive charts that can be shared to others with limited internet connection?
My situation is such that I can generate and view the interactive charts I want, but due to VPN restrictions, my colleagues are not able to open the html charts that I generate. From the error message below, it seems like they are not able to render due to inability to connect to the web.
(error loading script https //cdn.jsdelivr.net/npm//vega#5 noext)
Interactive Altair/Vega-Lite charts require several javascript libraries to render the charts; in most cases these libraries are loaded from an external CDN, and so the chart will not be viewable without an internet connection.
You can get around this using the altair_saver package, which is able to save HTML charts in "inline" mode, where the required javascript libraries are embedded directly in the chart output.
For example:
import altair_saver
chart = alt.Chart(df).mark_point() #...
altair_saver.save(chart, 'chart.html', inline=True)
The resulting file can be viewed in a javascript-enabled web browser, and should work even without an internet connection.

Jupyter: embed live interactive widgets

According to the Jupyter blog here, it is now possible to embed interactive widgets in a static webpage:
Live interactive widgets can now be embedded into static web pages or blogs by inserting an html snippet containing the serialized widget state. This also works with custom widget libraries. See http://jupyter.org/embed-jupyter-widgets.html.
When I open the example above, in firefox or chrome, I get the interactive widgets alright!
However, if I create a new notebook with the same bit of python code, save the notebook as html, and then copy-paste the embeddable HTML snippet to render the interactive widgets, it is not working. At best I obtain an image of the widget state, but nothing interactive.
Has anyone managed to replicate the HTML page with interactive widgets? Is there something that I am missing?
We made Kyso for exactly this. You can embed a jupyter notebook into a website using kyso.io, and as long as the widgets are supported by BokehJS dashboard, the notebook will be interactive. Here is an example
PS. (disclaimer - I’m a founder of kyso)
It's been a long time since the question was asked but I will answer with today technology.
In order to embed interactive widgets you need a backend but there is a Project called MyBinder that can be used as a backend in the cloud for free. This was used as the foundation of a library called NBinteract, which can convert any notebook with interactive widgets in a single HTML webpage.
These HTMLs load a script from a cdn and manage all the interaction with MyBinder by their own.
There are some examples in their website and I also published a post in my blog where I used this technology along with Dockerfile, ffmpeg, matplotlib, animations and interactive widgets. So I believe this approach is quite robust and flexible.
The official docs says you need a repo but I could manage to use gists instead and submited an issue in the main repo explaining how to do it.

Google Earth Questions: Making Outside Pages Appear in Google Earth and A Button That Follows

Good morning, eveyrone
I'm working on an application using Google Earth and I had two questions.
The first question involves the pop up window. I want to get an external website to appear in this bubble. I can either hardcode the website into the description of the placemark or use an iFrame. Are there any other options I can use to get a website into Google Earth?
Second question: I want to ensure that the user, at all times while using my kml, has access to certain buttons. Is there a way without querying web application every few seconds to ensure that the button remains available to the user?
Thank you for your time.
The answer to you first question is no - other than loading the html directly or using an IFRAME there is no way to display markup in the content balloons.
I am not sure what you mean in you second question, are you developing a web-based application using the Google Earth Plugin - or a kml layer for use in the google earth application. Either way you should not have to query anything to make sure a button is visible.

Resources