svelte-tiny-linked-charts 2.2.0 → 2.3.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/README.md +3 -0
- package/dist/LinkedChart.svelte +12 -2
- package/dist/LinkedChart.svelte.d.ts +24 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -104,6 +104,9 @@ scaleMax | 0 | Use this to overwrite the automatic scale set to the highest valu
|
|
|
104
104
|
scaleMax | 0 | Use this to overwrite the default value floor of 0.
|
|
105
105
|
type | bar | Can be set to "line" to display a line chart instead.
|
|
106
106
|
lineColor | fill | Color of the line if used with type="line".
|
|
107
|
+
lineFill | transparent | Color of the fill area if used with type="line".
|
|
108
|
+
lineWidth | 1 | Width of the line if used with type="line".
|
|
109
|
+
lineDotRadius | 0 (derived) | The size of the dot when hovering a line if used with type="line".
|
|
107
110
|
preserveAspectRatio | false | Sets whether or not the SVG will preserve it's aspect ratio.
|
|
108
111
|
tabindex | -1 | Sets the tabindex of each bar. When a tabindex of 0 is given, each bar will contain a title that describes the bar's label and value.
|
|
109
112
|
title | "" | Title that describes the chart for screen readers.
|
package/dist/LinkedChart.svelte
CHANGED
|
@@ -61,6 +61,9 @@
|
|
|
61
61
|
* @property {number} [scaleMin] Use this to overwrite the default value floor of 0.
|
|
62
62
|
* @property {"bar" | "line"} [type] Can be set to "line" to display a line chart instead.
|
|
63
63
|
* @property {string} [lineColor] Color of the line if used with type="line".
|
|
64
|
+
* @property {string} [lineFill] Color of the fill area if used with type="line".
|
|
65
|
+
* @property {number} [lineWidth] Width of the line if used with type="line".
|
|
66
|
+
* @property {number} [lineDotRadius] The size of the dot when hovering a line if used with type="line".
|
|
64
67
|
* @property {boolean} [preserveAspectRatio] Sets whether or not the SVG will preserve it's aspect ratio.
|
|
65
68
|
* @property {-1 | 0} [tabindex] Sets the tabindex of each bar. When a tabindex of 0 is given, each bar will contain a title that describes the bar's label and value.
|
|
66
69
|
* @property {string} [title] Title that describes the chart for screen readers.
|
|
@@ -101,6 +104,9 @@
|
|
|
101
104
|
scaleMin = 0,
|
|
102
105
|
type = "bar",
|
|
103
106
|
lineColor = fill,
|
|
107
|
+
lineFill = "transparent",
|
|
108
|
+
lineWidth = 1,
|
|
109
|
+
lineDotRadius = 0,
|
|
104
110
|
preserveAspectRatio = false,
|
|
105
111
|
tabindex = -1,
|
|
106
112
|
title = "",
|
|
@@ -238,7 +244,11 @@
|
|
|
238
244
|
|
|
239
245
|
<g transform="translate({alignmentOffset}, 0)">
|
|
240
246
|
{#if type == "line"}
|
|
241
|
-
|
|
247
|
+
{#if lineFill && lineFill !== "transparent"}
|
|
248
|
+
<polyline points={[...polyline, [width, height], [0, height]].join(" ")} fill={lineFill} />
|
|
249
|
+
{/if}
|
|
250
|
+
|
|
251
|
+
<polyline points={polyline.join(" ")} stroke={lineColor} stroke-width={lineWidth} fill="transparent" />
|
|
242
252
|
{/if}
|
|
243
253
|
|
|
244
254
|
{#each Object.entries(data) as [key, value], i}
|
|
@@ -254,7 +264,7 @@
|
|
|
254
264
|
{:else if type == "line"}
|
|
255
265
|
<circle
|
|
256
266
|
fill={hover && $hoveringKey[linkedKey] !== null && $hoveringKey[linkedKey] == key ? (fillArray[i] || fill) : "transparent"}
|
|
257
|
-
r={grow ? barMinWidth : barWidth / 2}
|
|
267
|
+
r={lineDotRadius || (grow ? barMinWidth : barWidth / 2)}
|
|
258
268
|
cy={height - getHeight(value)}
|
|
259
269
|
cx={((gap + barWidth) + (barWidth / (Object.keys(data).length))) * i} />
|
|
260
270
|
{/if}
|
|
@@ -118,6 +118,18 @@ declare const LinkedChart: import("svelte").Component<{
|
|
|
118
118
|
* Color of the line if used with type="line".
|
|
119
119
|
*/
|
|
120
120
|
lineColor?: string | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* Color of the fill area if used with type="line".
|
|
123
|
+
*/
|
|
124
|
+
lineFill?: string | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Width of the line if used with type="line".
|
|
127
|
+
*/
|
|
128
|
+
lineWidth?: number | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* The size of the dot when hovering a line if used with type="line".
|
|
131
|
+
*/
|
|
132
|
+
lineDotRadius?: number | undefined;
|
|
121
133
|
/**
|
|
122
134
|
* Sets whether or not the SVG will preserve it's aspect ratio.
|
|
123
135
|
*/
|
|
@@ -314,6 +326,18 @@ type Props = {
|
|
|
314
326
|
* Color of the line if used with type="line".
|
|
315
327
|
*/
|
|
316
328
|
lineColor?: string | undefined;
|
|
329
|
+
/**
|
|
330
|
+
* Color of the fill area if used with type="line".
|
|
331
|
+
*/
|
|
332
|
+
lineFill?: string | undefined;
|
|
333
|
+
/**
|
|
334
|
+
* Width of the line if used with type="line".
|
|
335
|
+
*/
|
|
336
|
+
lineWidth?: number | undefined;
|
|
337
|
+
/**
|
|
338
|
+
* The size of the dot when hovering a line if used with type="line".
|
|
339
|
+
*/
|
|
340
|
+
lineDotRadius?: number | undefined;
|
|
317
341
|
/**
|
|
318
342
|
* Sets whether or not the SVG will preserve it's aspect ratio.
|
|
319
343
|
*/
|