Skip to content

Commit

Permalink
resolve minor build error
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown committed Oct 5, 2019
1 parent 1c2669d commit 31b247e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 23 deletions.
29 changes: 16 additions & 13 deletions dist/erddap-timeseries-chart.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-shape'), require('d3-array'), require('d3-scale'), require('d3-axis')) :
typeof define === 'function' && define.amd ? define(['exports', 'd3-shape', 'd3-array', 'd3-scale', 'd3-axis'], factory) :
(global = global || self, factory(global.d3 = global.d3 || {}, global.d3));
}(this, function (exports, d3Shape) { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-array'), require('d3-selection'), require('d3-shape'), require('d3-axis'), require('d3-scale')) :
typeof define === 'function' && define.amd ? define(['exports', 'd3-array', 'd3-selection', 'd3-shape', 'd3-axis', 'd3-scale'], factory) :
(global = global || self, factory(global.d3 = global.d3 || {}, global.d3, global.d3, global.d3, global.d3, global.d3));
}(this, function (exports, d3Array, d3Selection, d3Shape, d3Axis, d3Scale) { 'use strict';

d3Array = d3Array && d3Array.hasOwnProperty('default') ? d3Array['default'] : d3Array;
d3Shape = d3Shape && d3Shape.hasOwnProperty('default') ? d3Shape['default'] : d3Shape;
d3Axis = d3Axis && d3Axis.hasOwnProperty('default') ? d3Axis['default'] : d3Axis;
d3Scale = d3Scale && d3Scale.hasOwnProperty('default') ? d3Scale['default'] : d3Scale;

function chart(){

Expand All @@ -30,8 +33,8 @@

function calculateDomains(){
if(x && y && data){
xDomain = d3.extent(data,x);
yDomain = d3.extent(data,y);
xDomain = d3Array.extent(data,x);
yDomain = d3Array.extent(data,y);
}
}

Expand Down Expand Up @@ -59,7 +62,7 @@
x = _;

if(data){
xDomain = d3.extent(data,x);
xDomain = d3Array.extent(data,x);
}
return chart;

Expand Down Expand Up @@ -88,7 +91,7 @@

z = _;
if(data){
z_domain = d3.extent(data,z);
z_domain = d3Array.extent(data,z);
}
return chart;

Expand Down Expand Up @@ -197,27 +200,27 @@


if(xDomain && yDomain){
let xScale = d3.scaleUtc()
let xScale = d3Scale.scaleUtc()
.domain(xDomain)
.range([margin.left, width - margin.right]),

yScale = d3.scaleLinear()
yScale = d3Scale.scaleLinear()
.domain(yDomain).nice()
.range([height - margin.bottom, margin.top]),

xAxis = g => g
.attr("transform", `translate(0,${height - margin.bottom})`)
.call(d3.axisBottom(xScale).ticks(width / 80).tickSizeOuter(0)),
.call(d3Axis.axisBottom(xScale).ticks(width / 80).tickSizeOuter(0)),
//need to add xLabel if exists here


yAxis = g => g
.attr("transform", `translate(${margin.left},0)`)
.call(d3.axisLeft(yScale))
.call(d3Axis.axisLeft(yScale))
.call(g => g.select(".domain").remove()),
//add yLabel here

line = d3.line()
line = d3Shape.line()
.defined(d => !isNaN(+x(d)))
.x(d=>xScale(x(d)))
.y(d=>yScale(y(d)));
Expand Down
22 changes: 12 additions & 10 deletions src/erddap-timeseries-chart.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import d3Select from "d3-select";
import d3Array from "d3-array";
import d3Select from "d3-selection";
import d3Shape from "d3-shape";
import d3Axis from "d3-axis";
import d3Scale from "d3-scale";

function chart(){

Expand Down Expand Up @@ -29,8 +31,8 @@ function chart(){

function calculateDomains(){
if(x && y && data){
xDomain = d3.extent(data,x);
yDomain = d3.extent(data,y)
xDomain = d3Array.extent(data,x);
yDomain = d3Array.extent(data,y)
}
}

Expand Down Expand Up @@ -58,7 +60,7 @@ function chart(){
x = _;

if(data){
xDomain = d3.extent(data,x)
xDomain = d3Array.extent(data,x)
}
return chart;

Expand Down Expand Up @@ -87,7 +89,7 @@ function chart(){

z = _;
if(data){
z_domain = d3.extent(data,z)
z_domain = d3Array.extent(data,z)
}
return chart;

Expand Down Expand Up @@ -199,27 +201,27 @@ function chart(){


if(xDomain && yDomain){
let xScale = d3.scaleUtc()
let xScale = d3Scale.scaleUtc()
.domain(xDomain)
.range([margin.left, width - margin.right]),

yScale = d3.scaleLinear()
yScale = d3Scale.scaleLinear()
.domain(yDomain).nice()
.range([height - margin.bottom, margin.top]),

xAxis = g => g
.attr("transform", `translate(0,${height - margin.bottom})`)
.call(d3.axisBottom(xScale).ticks(width / 80).tickSizeOuter(0)),
.call(d3Axis.axisBottom(xScale).ticks(width / 80).tickSizeOuter(0)),
//need to add xLabel if exists here


yAxis = g => g
.attr("transform", `translate(${margin.left},0)`)
.call(d3.axisLeft(yScale))
.call(d3Axis.axisLeft(yScale))
.call(g => g.select(".domain").remove()),
//add yLabel here

line = d3.line()
line = d3Shape.line()
.defined(d => !isNaN(+x(d)))
.x(d=>xScale(x(d)))
.y(d=>yScale(y(d)));
Expand Down

0 comments on commit 31b247e

Please sign in to comment.