I am working on a project using amcharts, and I'm trying to use the Export features.
I linked to my project export.js and export.css according the userguide, in this way i can finally see the download button/export button in the top right of my charts so the libs are correctly loaded.
Unfortunately i can't get any image or xslx from that, opening a console it comes 4 errors related to loading error on the 4 libraries useful to work with export:
fabric.js
FileSaver.js
jszip.js
pdfmake.js
if I try to attach manually pdfmake library, I can solve the dependency issue, but if I try to do the same with the others, the console still reports problems about loading error libs.
How I could solve this?
Related
Good day all. I'm new to Grafana and we adopted it very recently at work.
I'm willing to create a plugin, I need to load a simple external js library and fire it in a Grafana panel, nothing extreme.
First problem: I don't want to use any building library (grunt or whatever), I just want to write the plugin javascript, I don't want to redistribute it. Where do I write the code?
Am I right to write the code I want to execute in the data/plugins/myplugin/dist/ folder? (I'm trying to follow the steps at Grafana Docs, but they are unclear as they talk about building and install scripts which I don't like to use).
Second Problem: Seems like that if I use the dist/ folder, the plugin get executed. Now, I'd like to import a external.js library into it, the external library will take care of display the data as I like.
into my myplugin_ctrl.js I write this:
System.register(['app/plugins/sdk', 'lodash', './css/clock-panel.css!','./libs/datamaps'], function (_export, _context) {
var PanelCtrl, _, _createClass, panelDefaults, ClockCtrl;
As you may notice, I've used the clock plugin that is used into the how-to at Grafana.
I'd like to import './libs/datamaps', what I managed to do is having this error upon adding the panel to a dashboard:
Plugin component error Error: Fetch error: 404 Not Found
Instantiating http://127.0.0.1:3000/data/plugins/test-panel/libs/datamaps
Loading http://127.0.0.1:3000/public/plugins/test-panel/clock_ctrl.js
What I'm doing wrong? Where do the datamap.js should be? Or how do I can import it into Grafana plugin?
I don't know if you really need to solve this with a plugin, as I couldn't find any mention about data retrieval from any data sources in your question. Also, I'm not yet very familiar with Grafana plugin development, but I was able to solve one JavaScript related problem without a need to write a plugin.
What I did: I put a Text element in html mode on a dashboard and inserted a <script>...</script> section as well as some HTML code. This worked until I updated Grafana to a newer version, where they started to block this due to security reasons. After configuring /etc/grafana/grafana.ini setting disable_sanitize_html = true in section [panels], I made it work again. You could do this, too, but keep in mind that this is a security risk, because the dashboards now allow to inject any kind of malicious JavaScript code.
See also this Grafana reference page for scripted dashboards.
I have only gotten D3.js to load in a Jupyter Notebook once. That was when the path for my folder was "/lib/d3/d3.js". However, I downloaded both D3 v3.5 and v4.4, so I created different folders for both versions in my lib folder.
Ever since then, I haven't been able to get D3 to load in the notebook, and I have no idea why. I have even tried to load with CDN hosted versions, and have been unsuccessful. Is D3 picky about specifically having the "lib/d3/d3.js" path? This is what I've been doing:
Verify the path to the correct D3 file for the version I want to use
('python_data_analysis' is the root folderfolder structure
image
Load D3 into my Jupyter notebook (note: no errors on
load)referencing the path from step 1
Run my D3 code only to have Jupyter Notebook barf on the fact that
it doesn't know what d3 is:
"Javascript error adding output!
ReferenceError: d3 is not defined See your browser Javascript
console for more details."
Javascript console reveals that d3 is undefined.
What gives? At this point, I don't know what I'm doing wrong. It worked before, and the only thing different is the path. Are there some security settings at play that I'm not familiar with? Any help or suggestions would be greatly appreciated!
I have javascript file that looks like below. It has lots of object (1000+). As we cannot use dynamic name for images in react-native this is my work around.
"grinning": {
"image": require('./images/1f600.png'),
"shortname": ":grinning:",
}
I am requiring this file in some other react native function and looping to display all the images. But getting internal error on requiring too many images in javascript file.
{"type":"InternalError","message":"react-packager has encountered an internal error, please check your terminal error output for details"}
In terminal it says
fs operation timeout
This works if i remove few entries from the file.
Any suggestion or better approach
There are known issues with the Fresco library in charge of handling images, and memory limits:
Memory issues with PNG images
React Native Android depends on Fresco
for loading and displaying images. Currently we have disabled
downsampling because it is experimental, so you may run into memory
issues when loading large PNG images.
So maybe try compressing your images if you can, and only require them when they have to be rendered.
You should also check the bug tracker. Here is a comparable issue and its fix:
#phones24 wrote:
I optimized my app so it's not cached too many images. I also added
some more JPEG compression and scale the images down a bit. I also
wrote a path that adds error information to the event.
I'm looking for a pdf viewer that can load a pdf asynchronously. This is a big need in our site since the PDF documents have at least 50 pages.
I've already looked into pdf.js by mozilla but I can't seem to make it work (I think the examples are broken)
Any help would greatly be appreciated! Thanks!
UPDATED:
Got it working but my solution was messy. I integrated the web/viewer codebase of the pdf.js repo in my site. So whenever I need to view a pdf, I just used an iframe with a source #{pdf_viewer_path}?file=#{file_path}.
Is there a better solution than this?
NOTE: The above method does not work in a production setting. There are some js errors showing up when displaying the page. The only way I got it to work is to not precompile the js files of pdf.js.
This is an experimental solution. I just compiled the mozilla pdf.js library and integrated it with a rails engine. You can use the gem I made here: https://github.com/normancapule/pdfjs-rails-engine.
I am trying to generate pdf files in a cakePHP app, but so far get only html to be included in a file. The problem is that the main content of the page (calendar) is produced by the javascript which is completely ignored when generating a PDF. What is the best solution in this case?
I really appreciate your help.
If you use something like wkhtmltopdf it should work as it contains the actual rendering code used in chrome.
There is a plugin ready made that works out the box (after installing wkhtmltopdf)