Skip to content

Commit

Permalink
fix tests and get example wired up
Browse files Browse the repository at this point in the history
  • Loading branch information
akbstone committed Oct 5, 2019
1 parent d39006e commit 7b5addc
Show file tree
Hide file tree
Showing 6 changed files with 367 additions and 47 deletions.
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Create timeseries and QC chart:

```
```


Expand All @@ -33,14 +34,28 @@ Create QC-only chart:
```

Create curtain plot:

```
```


API
---

- ``data(arr)``
- ``x(fn)``
- ``y(fn)``
- ``x_label(str)``
- ``y_label(str)``
- ``qc_options(arr)``
- ``width(number)``
- ``height(number)``
- ``xLabel(str)``
- ``yLabel(str)``
- ``qcOptions(arr)``
- qc_option: ``{code:4,color:#FF0000,label:'Fail'}``

- ``drawLine``
- ``drawQc``
- ``drawCurtain``
- ``getDataAtX``
- ``getDataAtXY``
93 changes: 93 additions & 0 deletions examples/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<html>
<head>
<script src="https://d3js.org/d3-selection.v1.min.js"></script>
<script src="https://d3js.org/d3-path.v1.min.js"></script>
<script src="https://d3js.org/d3-shape.v1.min.js"></script>
<script src="https://d3js.org/d3-time.v1.min.js"></script>
<script src="https://d3js.org/d3-array.v2.min.js"></script>

<script src="https://d3js.org/d3-color.v1.min.js"></script>
<script src="https://d3js.org/d3-format.v1.min.js"></script>
<script src="https://d3js.org/d3-interpolate.v1.min.js"></script>
<script src="https://d3js.org/d3-time.v1.min.js"></script>
<script src="https://d3js.org/d3-time-format.v2.min.js"></script>
<script src="https://d3js.org/d3-scale.v3.min.js"></script>

<script src="https://d3js.org/d3-axis.v1.js"></script>

<script src="../build/erddap-timeseries-chart.js"></script>

</head>
<body>
<div class="line-chart"></div>
<script type="text/javascript">
let width = d3.select('.line-chart').node().offsetWidth,
height = 300,
data = [
{
time:new Date(2019,10,1),
value:10,
qc:1
},
{
time:new Date(2019,10,2),
value:11,
qc:3
},
{
time:new Date(2019,10,3),
value:4,
qc:3
},
{
time:new Date(2019,10,4),
value:5,
qc:4
},
{
time:new Date(2019,10,5),
value:2,
qc:1
}

],

qc_options = [
{
code:1,
color:'green',
label:'Pass'
},
{
code:3,
color:'orange',
label:'Suspect'
},
{
code:4,
color:'red',
label:'Fail'
}
],

chart = d3.erddap_timeseries_chart()
.data(data)
.width(width)
.height(height)
.x(d=>d.time)
.y(d=>d.value)
.chartType('line'),

chartSvg = d3.select('div.line-chart')
.append('svg')
.attr('width',width)
.attr('height',height)
.call(chart);



</script>


</body>
</html>
45 changes: 44 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
"d3-module"
],
"license": "BSD-3-Clause",
"jsnext:main": "index",
"homepage": "https://github.com/{USERNAME}/erddap-timeseries-chart",
"repository": {
"type": "git",
"url": "https://github.com/{USERNAME}/erddap-timeseries-chart"
},
"module":"index",
"main": "build/erddap-timeseries-chart.js",
"module": "src/index",
"files": [
"dist/**/*.js",
"src/**/*.js"
],
"scripts": {
Expand All @@ -31,6 +32,8 @@
},
"dependencies": {
"d3-array": "^2.3.2",
"d3-axis": "^1.0.12",
"d3-scale": "^3.1.0",
"d3-selection": "^1.4.0",
"d3-shape": "^1.3.5",
"d3-time": "^1.1.0"
Expand Down
6 changes: 4 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default {
input: 'src/index.js',
external: [ 'd3-selection','d3-array','d3-shape','d3-selection','d3-time' ],
external: [ 'd3-selection','d3-array','d3-shape','d3-axis','d3-scale' ],
output:{
format: 'umd',
name:'d3',
Expand All @@ -10,7 +10,9 @@ export default {
globals:{
'd3-array':'d3',
'd3-shape':'d3',
'd3-selection':'d3'
'd3-selection':'d3',
'd3-axis':'d3',
'd3-scale':'d3'
}
}
}
Loading

0 comments on commit 7b5addc

Please sign in to comment.