@jrkasprzyk/parcoord-es 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +160 -0
- package/dist/parcoords.css +61 -0
- package/dist/parcoords.esm.js +4132 -0
- package/dist/parcoords.esm.js.map +1 -0
- package/dist/parcoords.js +4130 -0
- package/dist/parcoords.js.map +1 -0
- package/dist/parcoords.standalone.js +11233 -0
- package/dist/parcoords.standalone.js.map +1 -0
- package/package.json +89 -0
- package/src/api/adjacentPairs.js +10 -0
- package/src/api/applyAxisConfig.js +35 -0
- package/src/api/applyDimensionDefaults.js +25 -0
- package/src/api/autoscale.js +133 -0
- package/src/api/axisDots.js +27 -0
- package/src/api/brushMode.js +50 -0
- package/src/api/brushReset.js +34 -0
- package/src/api/brushable.js +81 -0
- package/src/api/clear.js +21 -0
- package/src/api/commonScale.js +45 -0
- package/src/api/computeRealCentroids.js +8 -0
- package/src/api/createAxes.js +101 -0
- package/src/api/detectDimensionTypes.js +12 -0
- package/src/api/detectDimensions.js +7 -0
- package/src/api/flip.js +11 -0
- package/src/api/getOrderedDimensionKeys.js +8 -0
- package/src/api/highlight.js +26 -0
- package/src/api/init.js +53 -0
- package/src/api/interactive.js +7 -0
- package/src/api/intersection.js +16 -0
- package/src/api/mark.js +20 -0
- package/src/api/mergeParcoords.js +86 -0
- package/src/api/removeAxes.js +9 -0
- package/src/api/render.js +26 -0
- package/src/api/renderBrushed.js +39 -0
- package/src/api/renderDefault.js +27 -0
- package/src/api/renderMarked.js +34 -0
- package/src/api/reorder.js +37 -0
- package/src/api/reorderable.js +41 -0
- package/src/api/resize.js +36 -0
- package/src/api/scale.js +10 -0
- package/src/api/selected.js +209 -0
- package/src/api/shadows.js +9 -0
- package/src/api/sortDimensions.js +13 -0
- package/src/api/sortDimensionsByRowData.js +20 -0
- package/src/api/toString.js +11 -0
- package/src/api/toType.js +9 -0
- package/src/api/toTypeCoerceNumbers.js +7 -0
- package/src/api/unhighlight.js +12 -0
- package/src/api/unmark.js +12 -0
- package/src/api/updateAxes.js +103 -0
- package/src/bindEvents.js +60 -0
- package/src/brush/1d/brushExtents.js +73 -0
- package/src/brush/1d/brushFor.js +92 -0
- package/src/brush/1d/brushReset.js +36 -0
- package/src/brush/1d/index.js +20 -0
- package/src/brush/1d/install.js +41 -0
- package/src/brush/1d/selected.js +79 -0
- package/src/brush/1d/uninstall.js +12 -0
- package/src/brush/1d-multi/brushExtents.js +101 -0
- package/src/brush/1d-multi/brushFor.js +13 -0
- package/src/brush/1d-multi/brushReset.js +53 -0
- package/src/brush/1d-multi/drawBrushes.js +36 -0
- package/src/brush/1d-multi/index.js +20 -0
- package/src/brush/1d-multi/install.js +29 -0
- package/src/brush/1d-multi/newBrush.js +102 -0
- package/src/brush/1d-multi/selected.js +160 -0
- package/src/brush/1d-multi/uninstall.js +12 -0
- package/src/brush/angular/brushReset.js +14 -0
- package/src/brush/angular/index.js +19 -0
- package/src/brush/angular/install.js +141 -0
- package/src/brush/angular/onDrag.js +109 -0
- package/src/brush/angular/onDragEnd.js +30 -0
- package/src/brush/angular/onDragStart.js +38 -0
- package/src/brush/angular/removeStrum.js +12 -0
- package/src/brush/angular/selected.js +63 -0
- package/src/brush/angular/uninstall.js +17 -0
- package/src/brush/angular/util/hypothenuse.js +3 -0
- package/src/brush/consecutive.js +11 -0
- package/src/brush/dimensionsForPoint.js +32 -0
- package/src/brush/invertByScale.js +24 -0
- package/src/brush/strums/brushReset.js +14 -0
- package/src/brush/strums/index.js +19 -0
- package/src/brush/strums/install.js +81 -0
- package/src/brush/strums/onDrag.js +83 -0
- package/src/brush/strums/onDragEnd.js +20 -0
- package/src/brush/strums/onDragStart.js +33 -0
- package/src/brush/strums/removeStrum.js +10 -0
- package/src/brush/strums/selected.js +52 -0
- package/src/brush/strums/uninstall.js +16 -0
- package/src/index.js +226 -0
- package/src/parallel-coordinates.css +61 -0
- package/src/state/defaultConfig.js +36 -0
- package/src/state/index.js +86 -0
- package/src/state/sideEffects.js +89 -0
- package/src/util/colorPath.js +71 -0
- package/src/util/computeCentroids.js +44 -0
- package/src/util/computeClusterCentroids.js +33 -0
- package/src/util/computeControlPoints.js +38 -0
- package/src/util/dimensionLabels.js +11 -0
- package/src/util/flipAxisAndUpdatePCP.js +19 -0
- package/src/util/functor.js +3 -0
- package/src/util/getRange.js +24 -0
- package/src/util/getset.js +23 -0
- package/src/util/height.js +3 -0
- package/src/util/isBrushed.js +15 -0
- package/src/util/renderQueue.js +67 -0
- package/src/util/rotateLabels.js +18 -0
- package/src/util/width.js +3 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 Xing Yun
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# parcoords-es
|
|
2
|
+
|
|
3
|
+
ES6 module of Syntagmatic's [Parallel Coordinates](https://github.com/syntagmatic/parallel-coordinates) (aka. parcoords). This library is completely based on D3 V5 API.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Features
|
|
7
|
+
|
|
8
|
+
Please refer to [Parallel Coordinates](https://github.com/syntagmatic/parallel-coordinates)'s project page for concepts and API usage
|
|
9
|
+
|
|
10
|
+
All examples of the original project has been verified. You can play with them via running:
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
npm install
|
|
14
|
+
npm run dev
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## API
|
|
18
|
+
This section only lists api that are <b>deviated</b> from the original parallel coordinates.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
<a name="parcoords_brush_extents" href="#parcoords_brush_extents">#</a> parcoords.<b>brushExtents</b>(extents) supports 1D multi brushes:
|
|
22
|
+
|
|
23
|
+
1D brush [<>](https://github.com/BigFatDog/parcoords-es/blob/master/demo/setterForBrushes.html "Source")
|
|
24
|
+
```javascript
|
|
25
|
+
.brushMode("1D-axes")
|
|
26
|
+
.brushExtents({"2": [3,4]});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
1D multi brush [<>](https://github.com/BigFatDog/parcoords-es/blob/master/demo/setterForMultiBrushes.html "Source")
|
|
30
|
+
```javascript
|
|
31
|
+
.brushMode("1D-axes-multi")
|
|
32
|
+
.brushExtents({"2": [[3,4], [6,8], [10, 14]]});
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
when parameter `extents` is not provided, this function returns
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
const extents = parcoords.brushExtents();
|
|
40
|
+
// format is:
|
|
41
|
+
{
|
|
42
|
+
extents,
|
|
43
|
+
selection: {
|
|
44
|
+
raw, //raw coordinate
|
|
45
|
+
scaled //y-scale transformed
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
<a name="parcoords_marking" href="#parcoords_marking">#</a> parcoords.<b>mark</b>([values])
|
|
53
|
+
allows user to permanently highlight a data element in chart
|
|
54
|
+
```
|
|
55
|
+
const data = [...];
|
|
56
|
+
const pc = ParCoords().data(data)...;
|
|
57
|
+
parcoords.mark(data.filter(d => d.volume > 10));
|
|
58
|
+
```
|
|
59
|
+
Please refer to [marking demo](https://github.com/BigFatDog/parcoords-es/blob/develop/demo/marking.html "Source") for details
|
|
60
|
+
|
|
61
|
+
<a name="parcoords_unmark" href="#parcoords_unmark">#</a> parcoords.<b>unmark</b>()
|
|
62
|
+
clears all permanently highlighted data that is added by <a href="#parcoords_marking">mark([values])</a>
|
|
63
|
+
|
|
64
|
+
<a name="parcoords_brush_arg" href="parcoords_brush_arg">#</a> parccords.<b>on</b>(function(brushed, args){})
|
|
65
|
+
adds brush arguments to `brushstart`, `brush`, and `brushend` events.
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
parcoords.on('brushstart', function(brushed, args){
|
|
69
|
+
const {
|
|
70
|
+
selection: {
|
|
71
|
+
raw, //raw coordinate
|
|
72
|
+
scaled //y-scale transformed
|
|
73
|
+
},
|
|
74
|
+
node, // svg node
|
|
75
|
+
axis // dimension name
|
|
76
|
+
} = args;
|
|
77
|
+
})
|
|
78
|
+
```
|
|
79
|
+
Please refer to [brushing with arguments demo](https://github.com/BigFatDog/parcoords-es/blob/develop/demo/brush-with-arguments.html "Source") for details
|
|
80
|
+
|
|
81
|
+
## Usage
|
|
82
|
+
|
|
83
|
+
### ES6
|
|
84
|
+
1. Install library in your project
|
|
85
|
+
```
|
|
86
|
+
npm install parcoord-es --save
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
2. import module
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
import 'parcoord-es/dist/parcoords.css';
|
|
93
|
+
import ParCoords from 'parcoord-es';
|
|
94
|
+
|
|
95
|
+
const chart = ParCoords()....
|
|
96
|
+
```
|
|
97
|
+
### Standalone
|
|
98
|
+
|
|
99
|
+
parcoords.standalone.js contains all dependencies and can be used directly in your html page. Please note that only essential D3 V5 modules are bundled, your global namespace won't be polluted.
|
|
100
|
+
```
|
|
101
|
+
<link rel="stylesheet" type="text/css" href="./parcoords.css">
|
|
102
|
+
<script src="./parcoords.standalone.js"></script>
|
|
103
|
+
|
|
104
|
+
var parcoords = ParCoords()("#example")
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
You are free to use either D3 V3 or D3 V5 in your html. demo/superformula.html demonstrates how to use parcoords-es with d3 V3.
|
|
108
|
+
|
|
109
|
+
## Development
|
|
110
|
+
|
|
111
|
+
Follow this instruction to setup development environment for parcoords-es
|
|
112
|
+
### Prerequisites
|
|
113
|
+
|
|
114
|
+
npm
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
### Installing
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
npm install
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Building
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
npm run build
|
|
128
|
+
```
|
|
129
|
+
### Development
|
|
130
|
+
Internal server will be launched, hosting all demos at localhost:3004
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
npm run dev
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Testing (Coverage)
|
|
137
|
+
run all unit tests and generate test coverage report.
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
npm run test:cover
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Built With
|
|
144
|
+
|
|
145
|
+
* [D3 V5](https://d3js.org/) - D3 modules are used
|
|
146
|
+
* [Rollup](https://github.com/rollup/rollup) - Module bundler
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
## License
|
|
150
|
+
|
|
151
|
+
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
|
|
152
|
+
|
|
153
|
+
## Contributors
|
|
154
|
+
This project gets supports from open-source community. Many thanks to our [contributors](https://github.com/BigFatDog/parcoords-es/graphs/contributors)
|
|
155
|
+
|
|
156
|
+
## Contribution Notes
|
|
157
|
+
Run `npm run pretty` before committing.
|
|
158
|
+
|
|
159
|
+
## Acknowledgments
|
|
160
|
+
This project is based on [Parallel Coordinates](https://github.com/syntagmatic/parallel-coordinates) v0.7.0. Many thanks to [parcoords contributors](https://github.com/syntagmatic/parallel-coordinates/graphs/contributors) for such a complicated and useful D3 visualization.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
.parcoords > svg, .parcoords > canvas {
|
|
2
|
+
font: 14px sans-serif;
|
|
3
|
+
position: absolute;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.parcoords > canvas {
|
|
7
|
+
pointer-events: none;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.parcoords text.label {
|
|
11
|
+
cursor: default;
|
|
12
|
+
fill: black;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.parcoords rect.background {
|
|
16
|
+
fill: transparent;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.parcoords rect.background:hover {
|
|
20
|
+
fill: rgba(120, 120, 120, 0.2);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.parcoords .resize rect {
|
|
24
|
+
fill: rgba(0, 0, 0, 0.1);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.parcoords rect.extent {
|
|
28
|
+
fill: rgba(255, 255, 255, 0.25);
|
|
29
|
+
stroke: rgba(0, 0, 0, 0.6);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.parcoords .axis line, .parcoords .axis path {
|
|
33
|
+
fill: none;
|
|
34
|
+
stroke: #222;
|
|
35
|
+
shape-rendering: crispEdges;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.parcoords canvas {
|
|
39
|
+
opacity: 1;
|
|
40
|
+
-moz-transition: opacity 0.3s;
|
|
41
|
+
-webkit-transition: opacity 0.3s;
|
|
42
|
+
-o-transition: opacity 0.3s;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.parcoords canvas.faded {
|
|
46
|
+
opacity: 0.25;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.parcoords canvas.dimmed {
|
|
50
|
+
opacity: 0.85;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.parcoords {
|
|
54
|
+
-webkit-touch-callout: none;
|
|
55
|
+
-webkit-user-select: none;
|
|
56
|
+
-khtml-user-select: none;
|
|
57
|
+
-moz-user-select: none;
|
|
58
|
+
-ms-user-select: none;
|
|
59
|
+
user-select: none;
|
|
60
|
+
background-color: white;
|
|
61
|
+
}
|