layerchart 2.0.0-next.42 → 2.0.0-next.44
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/dist/components/Arc.svelte +1 -1
- package/dist/components/Axis.svelte +1 -9
- package/dist/components/Calendar.svelte +1 -1
- package/dist/components/Highlight.svelte +10 -0
- package/dist/components/MonthPath.svelte +1 -1
- package/dist/components/tooltip/TooltipContext.svelte +26 -0
- package/dist/docs/ViewSourceButton.svelte +1 -1
- package/dist/styles/skeleton-4.css +15 -0
- package/dist/utils/color.js +11 -8
- package/dist/utils/ticks.js +1 -1
- package/package.json +1 -1
|
@@ -251,7 +251,7 @@
|
|
|
251
251
|
const ctx = getChartContext();
|
|
252
252
|
|
|
253
253
|
const endAngle = $derived(
|
|
254
|
-
endAngleProp ?? degreesToRadians(ctx.
|
|
254
|
+
endAngleProp ?? degreesToRadians(ctx.xRange ? max(ctx.xRange) : max(range))
|
|
255
255
|
);
|
|
256
256
|
|
|
257
257
|
const motionEndAngle = createMotion(initialValue, () => value, motion);
|
|
@@ -125,15 +125,7 @@
|
|
|
125
125
|
|
|
126
126
|
import { extent } from 'd3-array';
|
|
127
127
|
import { pointRadial } from 'd3-shape';
|
|
128
|
-
import {
|
|
129
|
-
timeDay,
|
|
130
|
-
timeHour,
|
|
131
|
-
timeMillisecond,
|
|
132
|
-
timeMinute,
|
|
133
|
-
timeMonth,
|
|
134
|
-
timeSecond,
|
|
135
|
-
timeYear,
|
|
136
|
-
} from 'd3-time';
|
|
128
|
+
import { timeDay, timeHour, timeMillisecond, timeMinute, timeSecond, timeYear } from 'd3-time';
|
|
137
129
|
|
|
138
130
|
import { type FormatType, type FormatConfig, unique, PeriodType } from '@layerstack/utils';
|
|
139
131
|
import { cls } from '@layerstack/tailwind';
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
|
|
56
56
|
<script lang="ts">
|
|
57
57
|
import { type ComponentProps, type Snippet } from 'svelte';
|
|
58
|
-
import { timeDays, timeMonths, timeWeek
|
|
58
|
+
import { timeDays, timeMonths, timeWeek } from 'd3-time';
|
|
59
59
|
import { index } from 'd3-array';
|
|
60
60
|
import { format } from '@layerstack/utils';
|
|
61
61
|
|
|
@@ -264,6 +264,11 @@
|
|
|
264
264
|
tmpArea.width = max(xCoord) - min(xCoord); // Use first/last values for width
|
|
265
265
|
} else if (isScaleBand(ctx.xScale)) {
|
|
266
266
|
tmpArea.width = ctx.xScale.step();
|
|
267
|
+
} else if (ctx.xInterval) {
|
|
268
|
+
// x-axis time scale with interval
|
|
269
|
+
const start = ctx.xInterval.floor(xValue);
|
|
270
|
+
const end = ctx.xInterval.offset(start);
|
|
271
|
+
tmpArea.width = ctx.xScale(end) - ctx.xScale(start);
|
|
267
272
|
} else {
|
|
268
273
|
// Find width to next data point
|
|
269
274
|
const index = ctx.flatData.findIndex((d) => Number(x(d)) === Number(x(highlightData)));
|
|
@@ -290,6 +295,11 @@
|
|
|
290
295
|
tmpArea.height = max(yCoord) - min(yCoord); // Use first/last values for width
|
|
291
296
|
} else if (isScaleBand(ctx.yScale)) {
|
|
292
297
|
tmpArea.height = ctx.yScale.step();
|
|
298
|
+
} else if (ctx.yInterval) {
|
|
299
|
+
// y-axis time scale with interval
|
|
300
|
+
const start = ctx.yInterval.floor(yValue);
|
|
301
|
+
const end = ctx.yInterval.offset(start);
|
|
302
|
+
tmpArea.height = ctx.yScale(end) - ctx.yScale(start);
|
|
293
303
|
} else {
|
|
294
304
|
// Find width to next data point
|
|
295
305
|
const index = ctx.flatData.findIndex((d) => Number(y(d)) === Number(y(highlightData)));
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
</script>
|
|
36
36
|
|
|
37
37
|
<script lang="ts">
|
|
38
|
-
import { timeWeek
|
|
38
|
+
import { timeWeek } from 'd3-time';
|
|
39
39
|
import { cls } from '@layerstack/tailwind';
|
|
40
40
|
import { endOfInterval } from '@layerstack/utils';
|
|
41
41
|
import Spline, { type SplinePropsWithoutHTML } from './Spline.svelte';
|
|
@@ -518,6 +518,32 @@
|
|
|
518
518
|
height: ctx.yScale.step(),
|
|
519
519
|
data: d,
|
|
520
520
|
};
|
|
521
|
+
} else if (ctx.xInterval) {
|
|
522
|
+
// x-axis time scale with interval
|
|
523
|
+
const xVal = ctx.x(d);
|
|
524
|
+
const start = ctx.xInterval.floor(xVal);
|
|
525
|
+
const end = ctx.xInterval.offset(start);
|
|
526
|
+
|
|
527
|
+
return {
|
|
528
|
+
x: ctx.xScale(start),
|
|
529
|
+
y: isScaleBand(ctx.yScale) ? y - yOffset : min(ctx.yRange),
|
|
530
|
+
width: ctx.xScale(end) - ctx.xScale(start),
|
|
531
|
+
height: isScaleBand(ctx.yScale) ? ctx.yScale.step() : fullHeight,
|
|
532
|
+
data: d,
|
|
533
|
+
};
|
|
534
|
+
} else if (ctx.yInterval) {
|
|
535
|
+
// y-axis time scale with interval
|
|
536
|
+
const yVal = ctx.y(d);
|
|
537
|
+
const start = ctx.yInterval.floor(yVal);
|
|
538
|
+
const end = ctx.yInterval.offset(start);
|
|
539
|
+
|
|
540
|
+
return {
|
|
541
|
+
x: isScaleBand(ctx.xScale) ? x - xOffset : min(ctx.xRange),
|
|
542
|
+
y: ctx.yScale(start),
|
|
543
|
+
width: isScaleBand(ctx.xScale) ? ctx.xScale.step() : fullWidth,
|
|
544
|
+
height: ctx.yScale(end) - ctx.yScale(start),
|
|
545
|
+
data: d,
|
|
546
|
+
};
|
|
521
547
|
} else if (isScaleTime(ctx.xScale)) {
|
|
522
548
|
// Find width to next data point
|
|
523
549
|
const index = ctx.flatData.findIndex(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { ComponentProps } from 'svelte';
|
|
3
3
|
import { Button, Dialog, Toggle, Tooltip } from 'svelte-ux';
|
|
4
|
-
import LucideGithub from '~icons/lucide/github
|
|
4
|
+
import LucideGithub from '~icons/lucide/github';
|
|
5
5
|
|
|
6
6
|
import Code from './Code.svelte';
|
|
7
7
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.lc-root-container {
|
|
2
|
+
--color-primary: var(--color-primary-500);
|
|
3
|
+
|
|
4
|
+
--color-surface-100: var(--color-surface-50);
|
|
5
|
+
--color-surface-200: var(--color-surface-100);
|
|
6
|
+
--color-surface-300: var(--color-surface-200);
|
|
7
|
+
--color-surface-content: var(--base-font-color);
|
|
8
|
+
|
|
9
|
+
html.dark & {
|
|
10
|
+
--color-surface-100: var(--color-surface-700);
|
|
11
|
+
--color-surface-200: var(--color-surface-800);
|
|
12
|
+
--color-surface-300: var(--color-surface-900);
|
|
13
|
+
--color-surface-content: var(--base-font-color-dark);
|
|
14
|
+
}
|
|
15
|
+
}
|
package/dist/utils/color.js
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
/** Generator to create a new color on each call */
|
|
2
|
-
export function* rgbColorGenerator(step =
|
|
2
|
+
export function* rgbColorGenerator(step = 200) {
|
|
3
3
|
let nextColor = 0;
|
|
4
|
-
while (nextColor <
|
|
5
|
-
const r = nextColor &
|
|
6
|
-
const g = (nextColor
|
|
7
|
-
const b = (nextColor
|
|
4
|
+
while (nextColor < 1 << 21) {
|
|
5
|
+
const r = nextColor & 0x7f;
|
|
6
|
+
const g = (nextColor >> 7) & 0x7f;
|
|
7
|
+
const b = (nextColor >> 14) & 0x7f;
|
|
8
8
|
nextColor += step;
|
|
9
|
-
yield { r, g, b, a: 255 };
|
|
9
|
+
yield { r: r * 2, g: g * 2, b: b * 2, a: 255 };
|
|
10
10
|
}
|
|
11
11
|
return { r: 0, g: 0, b: 0, a: 255 };
|
|
12
12
|
}
|
|
13
13
|
export function getColorStr(color) {
|
|
14
|
+
const r = color.r & 0xfe;
|
|
15
|
+
const g = color.g & 0xfe;
|
|
16
|
+
const b = color.b & 0xfe;
|
|
14
17
|
if (color.a !== undefined) {
|
|
15
|
-
return `rgba(${
|
|
18
|
+
return `rgba(${r},${g},${b},${color.a})`;
|
|
16
19
|
}
|
|
17
20
|
else {
|
|
18
|
-
return `rgb(${
|
|
21
|
+
return `rgb(${r},${g},${b})`;
|
|
19
22
|
}
|
|
20
23
|
}
|
|
21
24
|
export function getColorIfDefined(data) {
|
package/dist/utils/ticks.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { timeYear,
|
|
1
|
+
import { timeYear, timeDay, timeTicks } from 'd3-time';
|
|
2
2
|
import { format, Duration, isLiteralObject, DateToken, } from '@layerstack/utils';
|
|
3
3
|
import { isScaleBand, isScaleTime } from './scales.svelte.js';
|
|
4
4
|
export function getDurationFormat(duration, options = {
|
package/package.json
CHANGED