As I embark on the journey of creating a miniature JS library using D3 to visualize line charts, I find myself navigating unfamiliar waters. However, I believe that deep diving into this project is the most effective way for me to learn.
Below is the content of my package.json
{
"name": "d3play02",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"d3-array": "^1.0.1",
"d3-axis": "^1.0.3",
"d3-request": "^1.0.2",
"d3-scale": "^1.0.3",
"d3-selection": "^1.0.2",
"d3-shape": "^1.0.3",
"d3-time-format": "^2.0.2",
"rollup": "^0.36.3",
"rollup-plugin-node-resolve": "^2.0.0",
"uglify-js": "^2.7.4"
},
"dependencies": {
"@types/d3": "^4.2.37"
}
}
In my file named LineChart.ts
, I have included:
/// <reference path="node_modules/@types/d3/node_modules/@types/d3-request/index.d.ts" />
import csv from 'd3-request';
class LineChart {
data(url: string): DsvRequest {
// code to go here
}
}
However, I encountered an error indicating that it cannot locate the d3-request
module, despite having it installed and following what I believed to be the correct import procedure!