@rokkit/chart 1.0.0-next.34 → 1.0.0-next.36
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/package.json +9 -8
- package/src/chart/SwatchGrid.svelte +1 -2
- package/src/chart/TimelapseChart.svelte +1 -2
- package/src/chart/Timer.svelte +1 -1
- package/src/components/index.js +0 -21
- package/src/components/lib/chart.js +0 -6
- package/src/components/lib/funnel.js +0 -2
- package/src/components/lib/rollup.js +1 -1
- package/src/components/lib/summary.js +0 -2
- package/src/components/store.js +2 -2
- package/src/plots/BarPlot.svelte +1 -1
- package/src/{components/plots/BarPlot.svelte → plots/BarPlot2.svelte} +0 -2
- package/src/plots/FunnelPlot.svelte +1 -1
- package/src/plots/LinePlot.svelte +0 -1
- package/src/plots/ViolinPlot.svelte +0 -1
- package/src/plots/heatmap.js +2 -2
- package/src/chart/PatternDefs.svelte +0 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rokkit/chart",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.36",
|
|
4
4
|
"description": "Components for making interactive charts.",
|
|
5
5
|
"author": "Jerry Thomas <me@jerrythomas.name>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,14 +15,15 @@
|
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@sveltejs/vite-plugin-svelte": "^2.4.2",
|
|
17
17
|
"@testing-library/svelte": "^4.0.3",
|
|
18
|
-
"@vitest/
|
|
18
|
+
"@vitest/coverage-v8": "^0.33.0",
|
|
19
|
+
"@vitest/ui": "~0.33.0",
|
|
19
20
|
"js-yaml": "^4.1.0",
|
|
20
21
|
"jsdom": "^22.1.0",
|
|
21
|
-
"svelte": "^4.0.
|
|
22
|
+
"svelte": "^4.0.5",
|
|
22
23
|
"typescript": "^5.1.6",
|
|
23
|
-
"vite": "^4.
|
|
24
|
-
"vitest": "~0.
|
|
25
|
-
"shared-config": "1.0.0-next.
|
|
24
|
+
"vite": "^4.4.4",
|
|
25
|
+
"vitest": "~0.33.0",
|
|
26
|
+
"shared-config": "1.0.0-next.36"
|
|
26
27
|
},
|
|
27
28
|
"dependencies": {
|
|
28
29
|
"d3-array": "^3.2.4",
|
|
@@ -31,9 +32,9 @@
|
|
|
31
32
|
"d3-shape": "^3.2.0",
|
|
32
33
|
"date-fns": "^2.30.0",
|
|
33
34
|
"ramda": "^0.29.0",
|
|
34
|
-
"rokkit": "
|
|
35
|
+
"rokkit": "latest",
|
|
35
36
|
"yootils": "^0.3.1",
|
|
36
|
-
"@rokkit/core": "1.0.0-next.
|
|
37
|
+
"@rokkit/core": "1.0.0-next.36"
|
|
37
38
|
},
|
|
38
39
|
"files": [
|
|
39
40
|
"src/**/*.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
}
|
|
29
29
|
let previous
|
|
30
30
|
function handleClick(row, column) {
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
if (previous) {
|
|
33
33
|
grid[previous.row][previous.column].isCurrent = false
|
|
34
34
|
}
|
|
@@ -36,7 +36,6 @@
|
|
|
36
36
|
previous = { row, column }
|
|
37
37
|
}
|
|
38
38
|
$: grid = toGrid(columns, rows, items)
|
|
39
|
-
$: console.log(grid)
|
|
40
39
|
</script>
|
|
41
40
|
|
|
42
41
|
<row class="flex flex-col gap-2">
|
|
@@ -52,7 +52,6 @@
|
|
|
52
52
|
let chart = base(data, x, y)
|
|
53
53
|
let temp = brewer().chart(data, x, y).use(theme).computeAxis()
|
|
54
54
|
axis = temp.axis
|
|
55
|
-
console.log(temp)
|
|
56
55
|
chart.data = sliceBy(chart.data, time, 3, 1)
|
|
57
56
|
stages = chart.data.length - 1
|
|
58
57
|
return chart
|
|
@@ -74,7 +73,7 @@
|
|
|
74
73
|
|
|
75
74
|
$: phased = timed(data, x, y, time)
|
|
76
75
|
$: $chart = switchChart(current)
|
|
77
|
-
|
|
76
|
+
|
|
78
77
|
|
|
79
78
|
// setup chart attributes that do not change over time
|
|
80
79
|
// get scales for x & y
|
package/src/chart/Timer.svelte
CHANGED
package/src/components/index.js
CHANGED
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
export { default as ColorRamp } from './elements/ColorRamp.svelte'
|
|
2
|
-
|
|
3
|
-
export { default as Symbol } from './chart/Symbol.svelte'
|
|
4
|
-
export { default as PatternDefs } from './chart/PatternDefs.svelte'
|
|
5
|
-
export { default as Swatch } from './chart/Swatch.svelte'
|
|
6
|
-
export { default as SwatchButton } from './chart/SwatchButton.svelte'
|
|
7
|
-
export { default as SwatchGrid } from './chart/SwatchGrid.svelte'
|
|
8
|
-
|
|
9
|
-
export { default as Axis } from './chart/Axis.svelte'
|
|
10
|
-
export { default as Grid } from './chart/Grid.svelte'
|
|
11
|
-
|
|
12
|
-
export { default as BoxPlot } from '../plots/BoxPlot.svelte'
|
|
13
|
-
export { default as ViolinPlot } from '../plots/ViolinPlot.svelte'
|
|
14
|
-
export { default as ScatterPlot } from '../plots/ScatterPlot.svelte'
|
|
15
|
-
export { default as FunnelPlot } from '../plots/FunnelPlot.svelte'
|
|
16
|
-
|
|
17
|
-
export { default as Chart } from './chart/Chart.svelte'
|
|
18
|
-
export { default as TimelapseChart } from './chart/TimelapseChart.svelte'
|
|
19
|
-
export { default as Timer } from './chart/Timer.svelte'
|
|
20
|
-
export { default as BarPlot } from './plots/BarPlot.svelte'
|
|
21
|
-
export { default as HeatMapCalendar } from '../plots/HeatMapCalendar.svelte'
|
|
22
1
|
export { toHexString, initCap, uniqueId, toNested } from './lib/utils'
|
|
23
2
|
export { brewer, uniques, slidingWindow, colors } from './lib/index'
|
|
@@ -134,7 +134,6 @@ export class ChartBrewer {
|
|
|
134
134
|
.rollup((d) => histogramBins(d.map((g) => +g[this.y])))
|
|
135
135
|
.entries(this.data)
|
|
136
136
|
|
|
137
|
-
// console.log(sumstat)
|
|
138
137
|
// What is the biggest number of value in a bin? We need it cause this value will have a width of 100% of the bandwidth.
|
|
139
138
|
var maxNum = 0
|
|
140
139
|
for (let i in sumstat) {
|
|
@@ -145,11 +144,6 @@ export class ChartBrewer {
|
|
|
145
144
|
maxNum = longest
|
|
146
145
|
}
|
|
147
146
|
}
|
|
148
|
-
// console.log(
|
|
149
|
-
// maxNum,
|
|
150
|
-
// this.axis.x.scale.bandwidth(),
|
|
151
|
-
// this.axis.x.scale('setosa')
|
|
152
|
-
// )
|
|
153
147
|
|
|
154
148
|
// The maximum width of a violin must be x.bandwidth = the width dedicated to a group
|
|
155
149
|
var xNum = scaleLinear()
|
|
@@ -183,11 +183,9 @@ export function funnel(input, aes, width, height) {
|
|
|
183
183
|
data = mirror(data, aes)
|
|
184
184
|
const curve =
|
|
185
185
|
aes.curve === 'basis' ? curveBasis : data.vertical ? curveBumpY : curveBumpX
|
|
186
|
-
// console.log(data)
|
|
187
186
|
|
|
188
187
|
if ('fill' in aes) {
|
|
189
188
|
let stats = flatten(data.stats.map((phase) => phase.value))
|
|
190
|
-
// console.log(stats)
|
|
191
189
|
|
|
192
190
|
data.stats = nest()
|
|
193
191
|
.key((d) => d[aes.fill])
|
|
@@ -18,7 +18,7 @@ function slidingWindowForNumbers(values, size, step, offset = 0, fmt = 0) {
|
|
|
18
18
|
if (smallest + count * step + offset == largest) {
|
|
19
19
|
count += 1
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
const range = [...Array(count).keys()]
|
|
23
23
|
|
|
24
24
|
const result = range.map((key) => ({
|
|
@@ -131,11 +131,9 @@
|
|
|
131
131
|
// export function funnel(input, aes) {
|
|
132
132
|
// let data = convertToPhases(input, aes)
|
|
133
133
|
// data = mirror(data, aes)
|
|
134
|
-
// // console.log(data)
|
|
135
134
|
|
|
136
135
|
// if ('fill' in aes) {
|
|
137
136
|
// let stats = flatten(data.stats.map((phase) => phase.value))
|
|
138
|
-
// // console.log(stats)
|
|
139
137
|
// data.stats = nest()
|
|
140
138
|
// .key((d) => d[aes.fill])
|
|
141
139
|
// .rollup((rows) => [...rows, { ...rows[rows.length - 1], x: rows.length }])
|
package/src/components/store.js
CHANGED
|
@@ -18,7 +18,7 @@ export function animatedChart(input, key, valueFields = [], previous = []) {
|
|
|
18
18
|
const toRemove = new Set(
|
|
19
19
|
[...previousKeys].filter((key) => !currentKeys.has(key))
|
|
20
20
|
)
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
let data = input
|
|
23
23
|
.filter((item) => toAdd.has(item[key]))
|
|
24
24
|
.map((item) => {
|
|
@@ -46,7 +46,7 @@ export function animatedChart(input, key, valueFields = [], previous = []) {
|
|
|
46
46
|
return el
|
|
47
47
|
})
|
|
48
48
|
data = [...prev, ...data]
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
return tweened(data, { duration: 500, easing: cubicOut })
|
|
51
51
|
}
|
|
52
52
|
// function createAxis() {
|
package/src/plots/BarPlot.svelte
CHANGED
package/src/plots/heatmap.js
CHANGED
|
@@ -25,7 +25,7 @@ export function summarize(data, dateField = 'date', valueField) {
|
|
|
25
25
|
: d.length
|
|
26
26
|
)
|
|
27
27
|
.entries(data)
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
return nested.reduce((obj, item) => ((obj[item.key] = item.value), obj), {})
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -40,7 +40,7 @@ export function heatmap(data, numberOfMonths) {
|
|
|
40
40
|
|
|
41
41
|
grid.map((d) => {
|
|
42
42
|
const month = format(endOfWeek(new Date(d.date)), 'MMM')
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
if (!(month in months)) {
|
|
45
45
|
months[month] = d.x
|
|
46
46
|
}
|