@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rokkit/chart",
3
- "version": "1.0.0-next.34",
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/ui": "~0.32.3",
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.1",
22
+ "svelte": "^4.0.5",
22
23
  "typescript": "^5.1.6",
23
- "vite": "^4.3.9",
24
- "vitest": "~0.32.3",
25
- "shared-config": "1.0.0-next.34"
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": "1.0.0-next.33",
35
+ "rokkit": "latest",
35
36
  "yootils": "^0.3.1",
36
- "@rokkit/core": "1.0.0-next.34"
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
- console.log(row, column, grid)
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
- // $: console.log(current, phased, chart)
76
+
78
77
 
79
78
  // setup chart attributes that do not change over time
80
79
  // get scales for x & y
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import { createEventDispatcher } from 'svelte'
3
- import { elapsed, timer } from 'rokkit/stores'
3
+ import { elapsed, timer } from '@rokkit/stores'
4
4
 
5
5
  const dispatch = createEventDispatcher()
6
6
 
@@ -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
- // console.log('count:', count)
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 }])
@@ -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
- console.log(toAdd, toRemove)
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
- console.log(data)
49
+
50
50
  return tweened(data, { duration: 500, easing: cubicOut })
51
51
  }
52
52
  // function createAxis() {
@@ -32,7 +32,7 @@
32
32
  }
33
33
  }))
34
34
 
35
- // $: console.log(data)
35
+
36
36
  </script>
37
37
 
38
38
  {#each data as { x, y, width, height, fill, label }}
@@ -12,11 +12,9 @@
12
12
  export let h = 10
13
13
 
14
14
  function size(value) {
15
- // console.log($chart.axis.x.scale, value)
16
15
  return $chart.axis.x.scale(value)
17
16
  }
18
17
  function top(value) {
19
- // console.log('Y', value)
20
18
  return $chart.axis.y.scale(value)
21
19
  }
22
20
 
@@ -13,7 +13,7 @@
13
13
 
14
14
  $: aes = { ...$chart.aes, ...compact({ x, y, fill, stat, curve }) }
15
15
  $: data = funnel($chart.data, aes, $chart.width, $chart.height)
16
- // $: console.log(data)
16
+
17
17
  </script>
18
18
 
19
19
  {#each data.stats as stat, i}
@@ -32,7 +32,6 @@
32
32
  }
33
33
  }))
34
34
 
35
- // $: console.log(data)
36
35
  </script>
37
36
 
38
37
  {#each data as { x1, y1, x2, y2, color, label }}
@@ -3,7 +3,6 @@
3
3
 
4
4
  let chart = getContext('chart')
5
5
  $: data = $chart.violin()
6
- // $: console.log(data)
7
6
  </script>
8
7
 
9
8
  {#each data as { x, curve }}
@@ -25,7 +25,7 @@ export function summarize(data, dateField = 'date', valueField) {
25
25
  : d.length
26
26
  )
27
27
  .entries(data)
28
- // console.log(Object.fromEntries(nested))
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
- // console.log(month)
43
+
44
44
  if (!(month in months)) {
45
45
  months[month] = d.x
46
46
  }
@@ -1,13 +0,0 @@
1
- <script>
2
- import Texture from './Texture.svelte'
3
- const size = 10
4
-
5
- export let thickness = 0.5
6
- export let patterns
7
- </script>
8
-
9
- <defs>
10
- {#each patterns as pattern}
11
- <Texture {...pattern} {thickness} {size} />
12
- {/each}
13
- </defs>