svelte-tiny-linked-charts 1.2.0 → 1.2.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.
- package/README.md +2 -1
- package/package.json +6 -1
- package/src/LinkedChart.svelte +3 -1
package/README.md
CHANGED
|
@@ -81,7 +81,8 @@ uid | | Unique ID to link this chart to a LinkedValue component with the same ui
|
|
|
81
81
|
height | 40 | Height of the chart in pixels.
|
|
82
82
|
width | 150 | Width of the chart in pixels.
|
|
83
83
|
barMinWidth | 4 | Width of the bars in the chart in pixels.
|
|
84
|
-
barMinHeight | 0 |
|
|
84
|
+
barMinHeight | 0 | Minimum height of the bars in the chart in pixels.
|
|
85
|
+
hideBarBelow | 0 | Bars below this value will be hidden, showing as 0 height.
|
|
85
86
|
grow | false | Whether or not the bar should grow to fill out the full width of the chart.
|
|
86
87
|
align | right | The side the bars should align to when they do not completely fill out the chart.
|
|
87
88
|
gap | 1 | Gap between the bars in pixels.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-tiny-linked-charts",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "rollup -c",
|
|
@@ -44,6 +44,11 @@
|
|
|
44
44
|
"main": "src/index.js",
|
|
45
45
|
"module": "src/index.mjs",
|
|
46
46
|
"svelte": "src/index.js",
|
|
47
|
+
"exports": {
|
|
48
|
+
".": {
|
|
49
|
+
"svelte": "./src/index.js"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
47
52
|
"author": {
|
|
48
53
|
"email": "mitchel_jager@hotmail.com",
|
|
49
54
|
"name": "mitcheljager"
|
package/src/LinkedChart.svelte
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
export let width = 150
|
|
12
12
|
export let barMinWidth = 4
|
|
13
13
|
export let barMinHeight = 0
|
|
14
|
+
export let hideBarBelow = 0
|
|
14
15
|
export let grow = false
|
|
15
16
|
export let align = "right"
|
|
16
17
|
export let gap = 1
|
|
@@ -62,7 +63,8 @@
|
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
function getHeight(value) {
|
|
65
|
-
|
|
66
|
+
if (value < hideBarBelow) return 0
|
|
67
|
+
return Math.max(Math.ceil((parseInt(height) / highestValue) * value - (type == "line" ? barWidth / 2 : 0)) || 0, barMinHeight)
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
function getBarWidth() {
|