score:2
use firefox, idk what chrome tries to accomplish
score:4
also, just learning d3 for school work. i was trying to run this simple d3 example: https://gist.github.com/d3noob/b3ff6ae1c120eea654b5
i had the same problem as op re: loading data using chrome browser. i bet the great solution hillary sanders posted above was re: python 2.x.
my answer is re: python 3.x [os: ubuntu 16x]:
open a terminal window within the root directory of your project, then run:
python3 -m http.server
it will serve http on port 8000 by default unless it is already taken, in that case to open another port, e.g. 7800, run:
python3 -m http.server 7800
then, on your chrome browser address bar type:
localhost:8000
the above worked for me because i only had an index.html page in my root folder. in case, you have a html page with a different name, type the whole path to that local html page and it should work also. and, you should be able to see the graph created from the data set in my link (that must be in a folder like data/data.csv). i hope this helps. :-)
score:6
to those using built-in python webserver and who are still experiencing issues, do remember and make sure that you run the "python -m simplehttpserver 8888" invocation at the correct path of which you consider to be your documentroot. that is, you cannot just run 'python -m simplehttpserver 8888' anywhere. you have to actually 'cd /to/correct/path/' containing your index.html or data.tsv and then from there run 'python -m simplehttpserver 8888'.
score:34
this confused me too (i am also a d3 beginner).
so, for some reason, web browsers are not happy about you loading local data, probably for security reasons or something. anyways, to get around this, you have to run a local web server. this is easy.
in your terminal, after cd
-ing to your website's document root (thanks @daixtr), type:
python -m simplehttpserver 8888 &
okay, now as long as that terminal window is open and running, your local 8888 web server will be running.
so in my case, originally the web page i was working on was called
file://localhost/users/hills/desktop/website/visualizing-us-bls-data-inflation-and-prices.html
when i opened it in chrome. to open up my page on my local web server, i just typed (into the chrome search bar):
http://localhost:8888/desktop/website/visualizing-us-bls-data-inflation-and-prices.html
now, reading in csvs should work. weird, i know.
Source: stackoverflow.com
Related Query
- Cannot import data from csv file in d3
- D3 Noob: Cannot bind to data read from csv file
- I cannot display a modified data from csv file
- How to load data from a CSV file in D3 v5
- display data from csv file into BarGraph using d3.js
- Unable to reference d3.js data imported from a csv file with spaces in the header
- graph the data from a csv file
- Only display 20 rows of data from a csv file with d3.js
- data is undefined after importing from a csv file with d3
- In Meteor, how can I import data from a .tsv file to use in a d3.js chart?
- ScatterChart in NVD3 – Reading the data from csv file
- D3.js using data from csv file to populate svg map
- D3.js - Load data from CSV file and use it outside function call
- how to transpose data from csv file in d3.js
- d3.js and data visualization from csv file graph width
- How to update data on a page according to data from a CSV file instead of using fixed element data on the page?
- How to plot data to map from csv file in D3.js
- I cannot generate a bar chart from csv file in d3.js
- getting and using data from CSV file d3 v5
- (Javascript with D3) Data from CSV file only being used once and returning undefined or NaN second time
- using variable to parse data with D3js when reading in from csv file
- Loading data from a CSV file to a lineWithFocusChart in D3
- How to extract data from a csv file and create a line chart from it in D3.js
- unable to read data from a CSV file using javascript
- D3js take data from an array instead of a file
- Importing data from multiple csv files in D3
- d3 - reading JSON data instead of CSV file
- D3.js loading local data file from file:///
- Select data from a CSV before loading it with javascript (d3 library)
- d3.js filter from csv file using multiple columns
More Query from same tag
- JS Download Image With Text added
- Animate D3 Heatmap cells on load?
- d3.js is not showing icons
- dc.js + make the chart dynamic based on the dataset
- Can't Parse JSON Date from SQL Server in Javascript
- How to update the contents of a text input with d3?
- Zooming to a clicked node on a D3 Force Directed Graph
- The array does not output properly
- Python equivalent of D3.js
- Transition Panels Sequentially Instead of all together (D3)
- Unexpected token on 3rd part library
- Using a variable in D3 data method to pull JSON data
- d3 vs. svg When Dealing with Element
- Choosing right tool for visualization
- D3.js: Hide the last tick on an axis?
- How to create a time dimension from just a day and time ? crossfilter
- Remove leading zero from d3.js timeFormat
- searching a d3 tree - reset after search
- Tooltip behavior on line chart with Date as the x-axis
- Angular - how do I get data to load with ngOnChanges
- d3js: Unable to place horizontally bars within the axis
- Issue with useInteractiveGuideline() in nvd3.js
- Draw multiple circles using d3.js in a 3x3 format
- NVD3 - Using JSON url data with LinePlusBarChart (mapping values)
- d3.js - select force layout group not update the nodes
- How can I fill gaps in a dc.js series chart?
- Leaflet + D3 - No mouseover on Safari
- Use custom function to create elements in d3.js
- D3 Javascript loop doesn't render
- D3: How to show large dataset