layerchart 0.14.0 → 0.14.2
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.
|
@@ -11,8 +11,8 @@ export let title = '';
|
|
|
11
11
|
export let width = 320;
|
|
12
12
|
export let height = 10;
|
|
13
13
|
export let ticks = width / 64;
|
|
14
|
-
export let tickFormat;
|
|
15
|
-
export let tickValues;
|
|
14
|
+
export let tickFormat = undefined;
|
|
15
|
+
export let tickValues = undefined;
|
|
16
16
|
export let tickFontSize = 10;
|
|
17
17
|
export let tickSize = 4;
|
|
18
18
|
export let placement = undefined;
|
|
@@ -120,44 +120,46 @@ else {
|
|
|
120
120
|
{...$$restProps}
|
|
121
121
|
>
|
|
122
122
|
<div class={cls('text-[10px] font-semibold', classes.title)}>{title}</div>
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
{
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
123
|
+
<slot values={tickValues} {scale}>
|
|
124
|
+
<svg
|
|
125
|
+
{width}
|
|
126
|
+
height={height + tickSize + tickFontSize}
|
|
127
|
+
viewBox="0 0 {width} {height + tickSize + tickFontSize}"
|
|
128
|
+
class="overflow-visible"
|
|
129
|
+
>
|
|
130
|
+
<g>
|
|
131
|
+
{#if interpolator}
|
|
132
|
+
<ColorRamp {width} {height} {interpolator} />
|
|
133
|
+
{:else if swatches}
|
|
134
|
+
{#each swatches as swatch, i}
|
|
135
|
+
<rect {...swatch} />
|
|
136
|
+
{/each}
|
|
137
|
+
{/if}
|
|
138
|
+
</g>
|
|
138
139
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
140
|
+
<g>
|
|
141
|
+
{#each tickValues ?? xScale?.ticks?.(ticks) ?? [] as tick, i}
|
|
142
|
+
<text
|
|
143
|
+
text-anchor="middle"
|
|
144
|
+
x={xScale(tick) + tickLabelOffset}
|
|
145
|
+
y={height + tickSize + tickFontSize}
|
|
146
|
+
style:font-size={tickFontSize}
|
|
147
|
+
class={classes.label}
|
|
148
|
+
>
|
|
149
|
+
{tickFormat ? format(tick, tickFormat) : tick}
|
|
150
|
+
</text>
|
|
150
151
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
152
|
+
{#if tickLine}
|
|
153
|
+
<line
|
|
154
|
+
x1={xScale(tick)}
|
|
155
|
+
y1={0}
|
|
156
|
+
x2={xScale(tick)}
|
|
157
|
+
y2={height + tickSize}
|
|
158
|
+
class={cls('stroke-black', classes.tick)}
|
|
159
|
+
/>
|
|
160
|
+
{/if}
|
|
161
|
+
{/each}
|
|
162
|
+
</g>
|
|
163
|
+
</svg>
|
|
164
|
+
</slot>
|
|
163
165
|
</div>
|
|
@@ -7,8 +7,8 @@ declare const __propDef: {
|
|
|
7
7
|
width?: number | undefined;
|
|
8
8
|
height?: number | undefined;
|
|
9
9
|
ticks?: number | undefined;
|
|
10
|
-
tickFormat
|
|
11
|
-
tickValues
|
|
10
|
+
tickFormat?: any;
|
|
11
|
+
tickValues?: any[] | undefined;
|
|
12
12
|
tickFontSize?: number | undefined;
|
|
13
13
|
tickSize?: number | undefined;
|
|
14
14
|
placement?: ("left" | "right" | "top" | "center" | "top-left" | "top-right" | "bottom-left" | "bottom" | "bottom-right") | undefined;
|
|
@@ -22,7 +22,12 @@ declare const __propDef: {
|
|
|
22
22
|
events: {
|
|
23
23
|
[evt: string]: CustomEvent<any>;
|
|
24
24
|
};
|
|
25
|
-
slots: {
|
|
25
|
+
slots: {
|
|
26
|
+
default: {
|
|
27
|
+
values: any[] | undefined;
|
|
28
|
+
scale: any;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
26
31
|
};
|
|
27
32
|
export type LegendProps = typeof __propDef.props;
|
|
28
33
|
export type LegendEvents = typeof __propDef.events;
|
package/dist/utils/ticks.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function getMajorTicks(start: Date, end: Date): import("d3-time").TimeInterval | null
|
|
1
|
+
export declare function getMajorTicks(start: Date, end: Date): import("d3-time").TimeInterval | null;
|
|
2
2
|
export declare function formatMajorTick(date: Date, rangeStart: Date, rangeEnd: Date): any;
|
|
3
|
-
export declare function getMinorTicks(start: Date, end: Date): import("d3-time").TimeInterval | null
|
|
3
|
+
export declare function getMinorTicks(start: Date, end: Date): import("d3-time").TimeInterval | null;
|
package/dist/utils/ticks.js
CHANGED
|
@@ -2,7 +2,7 @@ import { timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecon
|
|
|
2
2
|
import { format } from 'date-fns';
|
|
3
3
|
import { formatDate, PeriodType } from 'svelte-ux/utils/date';
|
|
4
4
|
import { getDuration } from 'svelte-ux/utils/duration';
|
|
5
|
-
import { fail } from 'svelte-ux
|
|
5
|
+
import { fail } from 'svelte-ux';
|
|
6
6
|
// TODO: Use PeriodType along with Duration to format (and possibly select intervals)
|
|
7
7
|
const majorTicks = [
|
|
8
8
|
{
|