I'm currently following the tutorial in Scott Murray's D3 book. His code for my specific problem is here: https://github.com/scotthmurray/d3-book/blob/master/chapter_07/09_time_scale.html
I copied his code into my index.html directly (for trouble shooting purposes) but it doesn't appear to be loading in my csv data correctly when I open my local host browser.
I'm trying to read in my "time_scale_data.csv" file which looks like below:
Below is I believe the relevant part of my D3 code but please see my link above for full code:
When I check my browser / console ... it looks like only the last row of data in my CSV file was loaded in instead of the whole dataset
According to the book, this is what the data should look like after I add dataset to the console:
Related
I am trying to import plugins/index.js to the new structure of Cypress 10 but unfortunately it is not working.
File Structure:
Looks like the folder structure is a little bit different to the out-of-the-box setup.
Based on the paths shown in the screenshot, I would guess you need to adjust the line with the error to
return require('../../../cypress/plugins/index.js`)
If it's still not working, take a look at the file structure to see what relative path is needed.
If still can't get it, post the file structure of the project up in the question.
I am using 4D version 11.6 (72398) in remote mode and am trying to export three pictures from a database. How do you extract pictures from the tool box? Screenshots and editing are not acceptable if avoidable.
The Picture Library area of the Tool Box does not have an export feature. However, the following commands will help you export the pictures:
PICTURE LIBRARY LIST gets an Array of Picture Names and an Array of Picture Reference ID's
GET PICTURE FROM LIBRARY uses the Picture Reference ID to get the picture from the Picture Library into a Picture variable.
WRITE PICTURE FILE writes the Picture variable to disk.
The following code could be used to export all of the pictures in the Picture Library to disk as PNG files.
C_TEXT($vsPicName;$vsFileName)
C_LONGINT($vlNbPictures;$vlPicture;$vlPicRef)
C_PICTURE($vgPicture)
ARRAY TEXT($asPicName;0)
PICTURE LIBRARY LIST($alPicRef;$asPicName)
$vlNbPictures:=Size of array($alPicRef)
If ($vlNbPictures>0)
For ($vlPicture;1;$vlNbPictures)
$vlPicRef:=$alPicRef{$vlPicture}
$vsPicName:=$asPicName{$vlPicture}
GET PICTURE FROM LIBRARY($alPicRef{$vlPicture};$vgPicture)
If (OK=1)
$vsFileName:=String($vlPicRef)+$vsPicName+".png"
WRITE PICTURE FILE($vsFileName;$vgPicture;".png")
End if
End for
Else
ALERT("The Picture Library is empty.")
End if
If you run the code above from Single-user or from the Server the files will be placed next to the structure file.
If you run the code above from from the Client the files will be placed into the 4D Client Cache folder which can be quickly opened using the following code:
SHOW ON DISK(Get 4D folder(4D Client Database Folder);*)
My question is whether or not anybody knows of a better way to do what I'm already doing. I'm creating a report as a list, and trying to render it both in HTML and Excel.
I'm developing a shiny app that generates reports for Qualtrics surveys.
The results table is a list of HTML strings that I paste together and display in a shinydashboard. Here's a dput of the example results tables.
Here's how I'm creating the html results tables list -- the html_tabelize() function in my package. Here's a dput of the example input.
In the shiny server.R file the way I create the Excel file is with the following code:
output$downloadResults <- downloadHandler(
filename = 'tables.xls',
content = function(file) {
write(html_tabelize(main()[['blocks']]), file)
}
)
To summarize: I get the blocks, I run html_tabelize on them, and then I write the HTML output to a file called "tables.xls". When I open that file, because Excel can render HTML, it renders something like this:
My concern and problem with what I'm doing are two-fold:
If I were writing an Excel document instead of simply rendering HTML in Excel, then I could perhaps get a better formatted document. I'd like that.
When you download the results tables xls file and try to open it, you get a warning from Excel. I don't want the users of my app to see this warning, because it's distracting and could worry them about something that isn't really a concern.
I know that options exist for writing Excel files in R, but so far what I've seen indicates that their input must be either a data frame, or a list of data frames. The list I am rendering from has different types of components, like the question text, as well as data frames of results. Originally I was using pandoc, but pandoc, even when run from R, is a system binary, and it's difficult to list as a dependency (and if I can't list it as a dependency, it's tough to make sure it's installed for the users of my app). Additionally, I found out pandoc doesn't even convert to "real" Excel -- it also just saves HTML in a .xls file. Does anybody have any suggestions as to how I can improve this part of my app?
I am having trouble loading the example code from dimple.js for the following chart:
http://dimplejs.org/advanced_examples_viewer.html?id=advanced_storyboard_control
The only change I made is to save it as a .csv instead of .tsv.
The code (index.html) is saved as:
"C:\website\public\index.html"
and the datafile is saved as:
"C:\website\public\data\example_data.csv"
Any reasons this wouldn't load?
Note: dimple example data file can be retrieved from: http://dimplejs.org/data/example_data.tsv
My code in index.html is exactly as the code from the dimple example page
except for the reference to the data file in line 7, I use:
d3.csv("/data/example_data.csv", function (data) {
When referencing the .tsv file instead of .csv there is no problem.
StillNot certain why the file format mattered for this, however.
Busy building a website for a client using classic ASP (It will reside on an old server) which is going to be used internally only.
The admin is able to view a paginated table of data and export this to CSV. This works fine when I save the CSV data to a CSV file but I have now been asked to try avoid the creation of the file if possibly and create the CSV in memory without the need for a file.
I have my doubts that this is possible but might be completely wrong. Is there anyway to send the CSV data to the browser such that it will open in Excel rather than having to create a CSV file and link to it as I am currently doing ?
TIA
John
Response.ContentType = "text/csv" will help you here. In the past I've paired that with a rewrite rule so that the URL is something like foo.com/example.csv but there are plenty of other ideas to be found in the following question: Response Content type as CSV