Make d3 an npm-managed dependency

Closes #91
This commit is contained in:
delucis
2019-08-19 16:25:06 +02:00
committed by Lachlan Kermode
parent 658a755e9d
commit b0e2e6dd45
8 changed files with 941 additions and 177 deletions

View File

@@ -6,7 +6,6 @@
<link rel="stylesheet" href="https://api.mapbox.com/mapbox.js/v3.1.1/mapbox.css">
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/5.7.0/d3.min.js" charset="utf-8"></script>
</head>
<body>
<style>

View File

@@ -14,7 +14,7 @@
},
"dependencies": {
"babel-polyfill": "^6.26.0",
"d3": "^4.9.1",
"d3": "^5.7.0",
"es6-promise": "^4.1.1",
"esm": "^3.2.25",
"joi": "^14.0.1",

View File

@@ -1,4 +1,5 @@
/* global d3 */
import { timeFormat, timeParse } from 'd3'
/**
* Get URI params to start with predefined set of
* https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript
@@ -67,14 +68,14 @@ export function parseDate (datetime) {
}
export function formatterWithYear (datetime) {
return d3.timeFormat('%d %b %Y, %H:%M')(datetime)
return timeFormat('%d %b %Y, %H:%M')(datetime)
}
export function formatter (datetime) {
return d3.timeFormat('%d %b, %H:%M')(datetime)
return timeFormat('%d %b, %H:%M')(datetime)
}
export const parseTimestamp = ts => d3.timeParse('%Y-%m-%dT%H:%M:%S')(ts)
export const parseTimestamp = ts => timeParse('%Y-%m-%dT%H:%M:%S')(ts)
export function compareTimestamp (a, b) {
return (parseTimestamp(a.timestamp) > parseTimestamp(b.timestamp))

View File

@@ -1,6 +1,6 @@
/* global d3 */
import React from 'react'
import { connect } from 'react-redux'
import * as d3 from 'd3'
import * as selectors from '../selectors'
import hash from 'object-hash'

View File

@@ -1,5 +1,5 @@
/* global d3 */
import React from 'react'
import * as d3 from 'd3'
class TimelineAxis extends React.Component {
constructor () {

View File

@@ -1,5 +1,5 @@
/* global d3 */
import React from 'react'
import * as d3 from 'd3'
class TimelineCategories extends React.Component {
constructor () {

View File

@@ -1,12 +1,13 @@
/* global d3 */
import { timeFormat, timeParse } from 'd3'
export function parseDateTimes (arrayToParse) {
const parsedArray = []
arrayToParse.forEach(item => {
let incomingDateTime = `${item.date}T00:00`
if (item.time) incomingDateTime = `${item.date}T${item.time}`
const parser = d3.timeParse(process.env.INCOMING_DATETIME_FORMAT)
item.timestamp = d3.timeFormat('%Y-%m-%dT%H:%M:%S')(parser(incomingDateTime))
const parser = timeParse(process.env.INCOMING_DATETIME_FORMAT)
item.timestamp = timeFormat('%Y-%m-%dT%H:%M:%S')(parser(incomingDateTime))
parsedArray.push(item)
})

1093
yarn.lock

File diff suppressed because it is too large Load Diff