svelte-plots-basic 2.5.8 → 3.0.1

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.
@@ -1,60 +0,0 @@
1
- <script>
2
- /****************************************************
3
- * Axis *
4
- * --------------------------------- *
5
- * generic element for X- or Y-axis *
6
- * !!! not for users !!! *
7
- *****************************************************/
8
-
9
- import { Colors } from '../Colors.js';
10
- import { getTickFactorLabel } from '../Utils.js';
11
-
12
- import AxisLines from './AxisLines.svelte';
13
- import AxisTickLabels from './AxisTickLabels.svelte';
14
-
15
- /*****************************************/
16
- /* Input parameters */
17
- /*****************************************/
18
-
19
- export let tickLabels = []; // vector with labels for each tick
20
- export let showGrid = false; // logical, show or not grid lines
21
- export let las = 1; // rotation of tick labels
22
-
23
- export let pos = 1; // position of tick labels
24
- export let className = ""; // name of CSS class for the axis
25
- export let grid = []; // array with grid coordinates
26
- export let axisLine = []; // array with coordinates of main axis line
27
- export let tickCoords = []; // array with axis tick coordinates
28
- export let tfCoords = []; // array with tick factor coordinates
29
- export let tickFactor = 0; // tick factor (as power of 10)
30
-
31
- export let lineColor = Colors.DARKGRAY; // color of main axis line
32
- export let gridColor = Colors.MIDDLEGRAY; // color of grid lines
33
- export let textColor = Colors.DARKGRAY; // color of tick labels
34
-
35
- // generate text for tick factor label
36
- </script>
37
-
38
- <g class="mdaplot__axis {className}">
39
- <!-- grid -->
40
- {#if showGrid }
41
- <AxisLines lineCoords={grid} lineColor={gridColor} lineType={3} />
42
- {/if}
43
-
44
- <!-- main axis line -->
45
- <AxisLines lineCoords={axisLine} lineColor={lineColor} lineType={1} />
46
-
47
- <!-- ticks-->
48
- <AxisLines lineCoords={tickCoords} lineColor={lineColor} lineType={1} />
49
-
50
- <!-- labels -->
51
- {#if tickCoords.length === 2 && tickLabels.length === tickCoords[1][0].length}
52
- <AxisTickLabels {las} {pos} {tickCoords} {tickLabels} {textColor} />
53
- {/if}
54
-
55
- <!-- tick factor -->
56
- {#if tickFactor !== 0}
57
- <AxisTickLabels {pos} tickCoords={tfCoords} tickLabels={[getTickFactorLabel(tickFactor)]} {textColor} />
58
- {/if}
59
- </g>
60
-
@@ -1,64 +0,0 @@
1
- <script>
2
- /****************************************************
3
- * Axis for 3D plots *
4
- * -------------------- *
5
- * shows main elements for axis (ticks, grid, etc.) *
6
- *****************************************************/
7
-
8
- import { Colors } from '../Colors';
9
- import AxisLines from './AxisLines.svelte';
10
- import TextLabels from './TextLabels.svelte';
11
- import AxisTickLabels from './AxisTickLabels.svelte';
12
-
13
-
14
- /*****************************************/
15
- /* Input parameters */
16
- /*****************************************/
17
-
18
- export let tickLabels = []; // vector with labels for each tick
19
- export let showGrid = false; // logical, show or not grid lines
20
- export let title = ''; // axis title
21
-
22
- export let className = '';
23
- export let grid1 = [];
24
- export let grid2 = [];
25
- export let axisLine = [];
26
- export let tickCoords = [];
27
- export let titleCoords = [];
28
-
29
- export let lineColor = Colors.DARKGRAY;
30
- export let gridColor = Colors.MIDDLEGRAY;
31
- export let textColor = Colors.DARKGRAY;
32
- </script>
33
-
34
- <g class="mdaplot__axis {className}">
35
-
36
- <!-- grid -->
37
- {#if showGrid }
38
- <AxisLines lineCoords={grid1} lineColor={gridColor} lineType={3} />
39
- <AxisLines lineCoords={grid2} lineColor={gridColor} lineType={3} />
40
- {/if}
41
-
42
- <!-- main axis line -->
43
- <AxisLines lineCoords={axisLine} lineColor={lineColor} lineType={1} />
44
-
45
- <!-- ticks-->
46
- <AxisLines lineCoords={[tickCoords[0], tickCoords[1]]} lineColor={lineColor} lineType={1} />
47
- <AxisLines lineCoords={[tickCoords[0], tickCoords[2]]} lineColor={lineColor} lineType={1} />
48
- <!-- <AxisLines lineCoords={[tickCoords[0], tickCoords[3]]} lineColor={lineColor} lineType={1} /> -->
49
-
50
- <!-- labels -->
51
- {#if tickCoords !== undefined }
52
- <AxisTickLabels tickCoords={tickCoords[4]} {textColor} {tickLabels} />
53
- {/if}
54
-
55
- <!-- title -->
56
- {#if titleCoords !== undefined && title !== ''}
57
- <TextLabels
58
- xValues={titleCoords[0]} yValues={titleCoords[1]} zValues={titleCoords[2]}
59
- faceColor={textColor}
60
- labels={title}
61
- />
62
- {/if}
63
- </g>
64
-
package/src/Colors.js DELETED
@@ -1,51 +0,0 @@
1
- export const Colors = {
2
- "AXIS_LINE": "#303030",
3
- "AXIS_TICK": "#606060",
4
- "WHITE": "#fff",
5
- "BLACK": "#000",
6
- "GRAY": "#909090",
7
- "MIDDLEGRAY": "#dadada",
8
- "LIGHTGRAY": "#f0f0f0",
9
- "DARKGRAY": "#606060",
10
- "LEGEND": "#303030",
11
-
12
- "PRIMARY": "#2679B2",
13
- "PRIMARY_LIGHT": "#d2ebff",
14
- "PRIMARY_TEXT": "#333",
15
- }
16
-
17
-
18
- /**
19
- * Returns an array with 'n' colors.
20
- *
21
- * @param {number} n - number of colors to return.
22
- *
23
- * @returns {Array} array with colors as strings (hexadecimal).
24
- *
25
- */
26
- export function getcolmap(n) {
27
- if (n == 1) return ["#2679B2"];
28
- if (n == 2) return ["#2679B2", "#D22C2F"];
29
- if (n == 3) return ["#2679B2", "#92B42A", "#D22C2F"];
30
- if (n == 4) return ["#2679B2", "#2E9658", "#F2B825", "#D22C2F"];
31
- if (n == 5) return ["#2679B2", "#22988A", "#92B42A", "#F79426", "#D22C2F"];
32
- if (n == 6) return ["#2679B2", "#1C9AA8", "#379531", "#EED524", "#FB7F28", "#D22C2F"];
33
- if (n == 7) return ["#2679B2", "#1D94A9", "#2E9658", "#92B42A", "#F2B825", "#F47129", "#D22C2F"];
34
- if (n == 8) return ["#2679B2", "#1E90AA", "#279775", "#519E2F", "#D3CB25", "#F5A326", "#EF672A", "#D22C2F"];
35
- if (n == 9) return ["#2679B2", "#1F8DAB", "#22988A", "#33953F", "#92B42A", "#EFCA24", "#F79426", "#EB5F2A", "#D22C2F"];
36
- if (n == 10) return ["#2679B2", "#208BAC", "#1E999A", "#2E9658", "#5FA32E", "#C5C626", "#F2B825", "#F98827", "#E85A2B", "#D22C2F"];
37
- if (n == 11) return ["#2679B2", "#2089AD", "#1C9AA8", "#29976C", "#379531", "#92B42A", "#EED524", "#F4AA26", "#FB7F28",
38
- "#E6552B", "#D22C2F"];
39
- if (n == 12) return ["#2679B2", "#2188AD", "#1C97A8", "#25987C", "#329546", "#68A62D", "#BCC327", "#F0C524", "#F69E26",
40
- "#F77728", "#E4512B", "#D22C2F"];
41
- if (n == 13) return ["#2679B2", "#2186AD", "#1D94A9", "#22988A", "#2E9658", "#469A2F", "#92B42A", "#DECF25", "#F2B825",
42
- "#F79426", "#F47129", "#E34E2C", "#D22C2F"];
43
- if (n == 14) return ["#2679B2", "#2285AE", "#1E92AA", "#209995", "#2A9767", "#34953A", "#6FA82D", "#B5C128", "#EFCE24", "#F3AD25",
44
- "#F98C27", "#F16B29", "#E14B2C", "#D22C2F"];
45
- if (n == 15) return ["#2679B2", "#2284AE", "#1E90AA", "#1D999F", "#279775", "#31964A", "#519E2F", "#92B42A", "#D3CB25", "#F0C224",
46
- "#F5A326", "#FA8527", "#EF672A", "#E0492C", "#D22C2F"];
47
-
48
- // if n > 15 return 16 colors
49
- return ["#2679B2", "#2283AE", "#1F8FAB", "#1C9AA8", "#249880", "#2E9658", "#379531", "#73AA2C", "#B0BF28", "#EDD424", "#F2B825",
50
- "#F69B26", "#FB7F28", "#ED632A", "#DF472C", "#D22C2F"];
51
- }