I've read several Threads here on d3.js and JSON, I could not fix my problem though.
Please see the picture attached. I'm working with Vaadin and integrated d3.js into my project. I now owuld like to display a forced graph with d3.js, using a local graph.json file.
All code works - except accessing the .json file.
The webapplication/website is displayed correctly, but the graph is empty/not there.
I assume the error lays somewhere here:
d3.json("graph.json", function(error, graph) {...}
please see picture here
I'd appreciate any help. (inb4 new to javascript)
Related
I am trying to display R code and output in the CANVAS LMS (specifically within a page, not just as a separate html file). I have had no joy Googling this so hopefully someone can help.
What I have tried (as a simple test) but hasn't worked: In RStudio created a new RMarkdown HTML document (the basic default one with a sample table and sample plot). Used Knitr to create the html file. Opened HTML file and copied code into the LMS (raw html editor). This kind of works but doesn't show the plot and has some of the code that I didn't need to copy (see image).
Presumably there is a smarter way to do this but I can't find any good resources.
There were two issues here. I solved (1) and have identified but not fully solved (2)
One was that I should have been using output: html_fragment instead of html_document to get html to embed in to Canvas (otherwise it is trying to put html inside html and gets confused)
The second I haven't fully resolved but the issue is that when I hit save on the Canvas page the editor strips any base64 images (which is all the plots). I haven't worked out if this is a general issue or the particular editor that is being used on the version of Canvas I am working with.
I used html2pdf in my code to enable converting html files to pdf ones then downloading them.
In my html file I have some statistic graphics coded using amChart.
The problem is that I have got a perfect file but with corrupted parts. The parts that contains the amChart graphics.Here is the graph in the html page:
and here is what I have got in the downloaded pdf file
I used this code to enable the download (with angular I just installed the necessary dependecies using bower).
Hello Someone
<div pdf-save-content="idOne" >
Hello Someone
</div>
Can someone please help me fix this problem?
I know that amchart provides a library to download the graphs with different forms (csv, png,pdf,..) it's not what need, I need to download the whole page.
it's not either a width problem.
to solve this problem I used this amCharts demo. It was better to use pdfMake than html2pdf
chart["export"].toPDF(layout, function(data) {
this.download(data, "application/pdf", "amCharts.pdf");
});
We are using HTTPHandler to show images in our ASP.NET application, it works perfect, but we encounter issues when calling the images when generating PDF's.
Because while generating PDF from HTML, the absolute image path to be given, it doesn't take httphandler generated image. We changing the image src path to point to httphandler like this path http://localhost/MyHttpHandler.ashx?ID=100".
But httphandler not at all get called. PDF got created without the image, because image is not present actually in the web server. It is present outside the application hosted folder. Please advise us to overcome this challenge.
Thanks in advance.
I need to be able to build an html page and then save the rendered html output to an image. Before I switched to Go, I was accomplishing this with NodeJS and PhantomJS by building a "headless" webpage and capturing the image with a screenshot into an image file. I need to be able to do the same thing in Go. I know how to build the HTML template using the html/template package. But, I am lost on how I get essentially capture a screenshot of the rendered HTML and save it to an image with a specified width and height. This was fairly easy in PhantomJS by just calling the 'Render' method and passing the location of the image to save to. But, I can't find anyway to do this in Go.
Any help is greatly appreciated!
I'm currently "learning" d3js by myself and I found a lot of examples here. It seems that for all the visualizations we need two separated files. One is a script (an html file) and the other one is a json file which contains our data set.
I'm curious if there is a way to put the json file into html file so we can have only one file. I think I saw an example like this previously on the internet but I lost it.
The only reason I want to do it like this is that if data set is separated from html file, I cannot use Chrome to view my result (I think Chrome is blocking the script from reading local data set). I can use Firefox to open up my result but the animation doesn't perform smoothly.
Maybe some of my understanding is not really right. But if there is any suggestions please let me know. Thanks in advance.
If you're just using one HTML file, you probably have a <script> tag on your page where all the code is located. You can define your data as a Javascript array.
It can be nice to use multiple files to organize code, data, and view elements (the HTML). This page gives some help on setting your browser to let you do that. For Chrome, close all open windows. Then run Chrome from the 'Run' prompt with this flag: chrome --allow-file-access-from-files