@emerson-eps/color-tables 0.2.10 → 0.2.13
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/component/ColorSelector/ColorSelectorAccordion.js +2 -2
- package/dist/component/ColorSelector/ColorSelectorAccordion.js.map +1 -1
- package/dist/component/ColorSelector/ColorSelectorComponent.d.ts +0 -3
- package/dist/component/ColorSelector/ColorSelectorComponent.js +5 -15
- package/dist/component/ColorSelector/ColorSelectorComponent.js.map +1 -1
- package/dist/component/ColorSelector/ColorSelectorWrapper.d.ts +0 -1
- package/dist/component/ColorSelector/ColorSelectorWrapper.js +13 -12
- package/dist/component/ColorSelector/ColorSelectorWrapper.js.map +1 -1
- package/dist/component/Legend/ColorLegend.js +11 -3
- package/dist/component/Legend/ColorLegend.js.map +1 -1
- package/dist/component/Legend/ContinuousLegend.d.ts +1 -1
- package/dist/component/Legend/ContinuousLegend.js +18 -4
- package/dist/component/Legend/ContinuousLegend.js.map +1 -1
- package/dist/component/Legend/DiscreteLegend.d.ts +1 -2
- package/dist/component/Legend/DiscreteLegend.js +31 -34
- package/dist/component/Legend/DiscreteLegend.js.map +1 -1
- package/dist/component/{ColorTableTypes.d.ts → Utils/ColorTableTypes.d.ts} +0 -0
- package/dist/component/{ColorTableTypes.js → Utils/ColorTableTypes.js} +0 -0
- package/dist/component/Utils/ColorTableTypes.js.map +1 -0
- package/dist/component/Utils/continousLegend.d.ts +2 -2
- package/dist/component/Utils/continousLegend.js.map +1 -1
- package/dist/component/Utils/discreteLegend.js +9 -78
- package/dist/component/Utils/discreteLegend.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/stories/ColorLegends/{SingleComponent/Single.stories.d.ts → LegendWithSelector/LegendSelector.stories.d.ts} +1 -1
- package/dist/stories/ColorLegends/{SingleComponent/Single.stories.js → LegendWithSelector/LegendSelector.stories.js} +5 -5
- package/dist/stories/ColorLegends/LegendWithSelector/LegendSelector.stories.js.map +1 -0
- package/package.json +1 -1
- package/src/component/ColorSelector/ColorSelectorAccordion.tsx +2 -2
- package/src/component/ColorSelector/ColorSelectorComponent.tsx +5 -22
- package/src/component/ColorSelector/ColorSelectorWrapper.tsx +49 -48
- package/src/component/Legend/ColorLegend.tsx +20 -3
- package/src/component/Legend/ContinuousLegend.tsx +18 -5
- package/src/component/Legend/DiscreteLegend.tsx +36 -67
- package/src/component/{ColorTableTypes.ts → Utils/ColorTableTypes.ts} +0 -0
- package/src/component/Utils/continousLegend.ts +3 -3
- package/src/component/Utils/discreteLegend.ts +9 -83
- package/src/index.ts +2 -3
- package/src/stories/ColorLegends/{SingleComponent/Single.stories.jsx → LegendWithSelector/LegendSelector.stories.jsx} +4 -4
- package/tsconfig.json +2 -2
- package/dist/component/ColorTableTypes.js.map +0 -1
- package/dist/stories/ColorLegends/LegendWithSelector/DiscreteLegendWithSelector.stories.d.ts +0 -7
- package/dist/stories/ColorLegends/LegendWithSelector/DiscreteLegendWithSelector.stories.js +0 -52
- package/dist/stories/ColorLegends/LegendWithSelector/DiscreteLegendWithSelector.stories.js.map +0 -1
- package/dist/stories/ColorLegends/LegendWithSelector/LegendWithSelector.stories.d.ts +0 -7
- package/dist/stories/ColorLegends/LegendWithSelector/LegendWithSelector.stories.js +0 -38
- package/dist/stories/ColorLegends/LegendWithSelector/LegendWithSelector.stories.js.map +0 -1
- package/dist/stories/ColorLegends/SingleComponent/Single.stories.js.map +0 -1
- package/src/stories/ColorLegends/LegendWithSelector/DiscreteLegendWithSelector.stories.jsx +0 -44
- package/src/stories/ColorLegends/LegendWithSelector/LegendWithSelector.stories.jsx +0 -30
|
@@ -2,11 +2,14 @@ import * as React from "react";
|
|
|
2
2
|
import { useRef } from "react";
|
|
3
3
|
import discreteLegendUtil from "../Utils/discreteLegend";
|
|
4
4
|
import { select, scaleOrdinal } from "d3";
|
|
5
|
-
import { colorTablesArray
|
|
5
|
+
import { colorTablesArray } from "../Utils/ColorTableTypes";
|
|
6
|
+
import { colorsArray } from "../Utils/continousLegend"
|
|
7
|
+
import {d3ColorScales} from "../Utils/d3ColorScale";
|
|
6
8
|
|
|
7
9
|
declare type ItemColor = {
|
|
8
10
|
color: string;
|
|
9
|
-
|
|
11
|
+
name?: string
|
|
12
|
+
};
|
|
10
13
|
|
|
11
14
|
declare type colorLegendProps = {
|
|
12
15
|
discreteData: { objects: Record<string, [number[], number]> };
|
|
@@ -16,7 +19,7 @@ declare type colorLegendProps = {
|
|
|
16
19
|
colorTables: colorTablesArray | string;
|
|
17
20
|
horizontal?: boolean | null;
|
|
18
21
|
updateLegend?: any
|
|
19
|
-
}
|
|
22
|
+
};
|
|
20
23
|
|
|
21
24
|
export const DiscreteColorLegend: React.FC<colorLegendProps> = ({
|
|
22
25
|
discreteData,
|
|
@@ -30,8 +33,6 @@ export const DiscreteColorLegend: React.FC<colorLegendProps> = ({
|
|
|
30
33
|
const divRef = useRef<HTMLDivElement>(null);
|
|
31
34
|
let itemName: string[] = [];
|
|
32
35
|
let itemColor: ItemColor[] = [];
|
|
33
|
-
const testColor: ItemColor[] = [];
|
|
34
|
-
const testName: string[] = [];
|
|
35
36
|
|
|
36
37
|
React.useEffect(() => {
|
|
37
38
|
if (divRef.current) {
|
|
@@ -56,40 +57,50 @@ export const DiscreteColorLegend: React.FC<colorLegendProps> = ({
|
|
|
56
57
|
dataSet = await res.json();
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
const
|
|
60
|
+
const arrayOfColors =
|
|
60
61
|
typeof colorTables === "string"
|
|
61
|
-
?
|
|
62
|
-
:
|
|
62
|
+
? colorsArray(colorName, dataSet)
|
|
63
|
+
: colorsArray(colorName, colorTables);
|
|
63
64
|
|
|
64
|
-
|
|
65
|
+
const d3ColorArrays = colorsArray(colorName, d3ColorScales)
|
|
65
66
|
|
|
66
67
|
// Main discrete legend
|
|
67
68
|
if (!updateLegend || updateLegend.length == 0) {
|
|
68
69
|
Object.keys(discreteData).forEach((key) => {
|
|
69
70
|
//eslint-disable-next-line
|
|
70
71
|
let code = (discreteData as { [key: string]: any })[key][1]
|
|
71
|
-
//
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
72
|
+
// for colortable colors
|
|
73
|
+
if (arrayOfColors.length > 0) {
|
|
74
|
+
//compare the first value in colorarray(colortable) and code from discreteData
|
|
75
|
+
const matchedColorsArrays = arrayOfColors.find(
|
|
76
|
+
(value: number[]) => {
|
|
77
|
+
return value[0] == code;
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
if (matchedColorsArrays)
|
|
81
|
+
itemColor.push({
|
|
82
|
+
color: RGBToHex(matchedColorsArrays),
|
|
83
|
+
name: key
|
|
84
|
+
});
|
|
85
|
+
itemName.push(key);
|
|
86
|
+
}
|
|
87
|
+
// for d3 colors
|
|
88
|
+
else {
|
|
89
|
+
var matchedColorsArrays = d3ColorArrays.find((value: number,index: number) => {
|
|
90
|
+
return index == code;
|
|
80
91
|
});
|
|
81
|
-
|
|
92
|
+
if(matchedColorsArrays) itemColor.push({color: matchedColorsArrays});
|
|
93
|
+
}
|
|
94
|
+
|
|
82
95
|
});
|
|
83
96
|
useSelectorLegend = false;
|
|
84
97
|
}
|
|
85
98
|
// Discrete legend using Colortable colors
|
|
86
99
|
else if (updateLegend?.color) {
|
|
87
100
|
updateLegend.color.forEach((key: any) => {
|
|
88
|
-
|
|
101
|
+
itemColor.push({ color: RGBToHex(key) });
|
|
89
102
|
});
|
|
90
103
|
|
|
91
|
-
itemColor = testColor;
|
|
92
|
-
itemName = testName;
|
|
93
104
|
useSelectorLegend = true;
|
|
94
105
|
}
|
|
95
106
|
// Discrete legend using d3 colors
|
|
@@ -98,41 +109,17 @@ export const DiscreteColorLegend: React.FC<colorLegendProps> = ({
|
|
|
98
109
|
itemColor.push({ color: key });
|
|
99
110
|
});
|
|
100
111
|
|
|
101
|
-
//itemColor = itemColor;
|
|
102
112
|
itemName = updateLegend.legendColorName;
|
|
103
113
|
useSelectorLegend = true;
|
|
104
114
|
}
|
|
105
115
|
|
|
106
|
-
// const toolTipName = itemName.map((word, idx) => {
|
|
107
|
-
// return <li key={idx}>{word}</li>;
|
|
108
|
-
// });
|
|
109
|
-
|
|
110
|
-
// let nameTool;
|
|
111
|
-
|
|
112
|
-
// toolTipName.forEach((data) => {
|
|
113
|
-
// //nameTool.push(data.props.children)
|
|
114
|
-
// nameTool = data.props.children;
|
|
115
|
-
// });
|
|
116
|
-
|
|
117
|
-
// // create a tooltip
|
|
118
|
-
// const tooltip = select(divRef.current)
|
|
119
|
-
// .append("div")
|
|
120
|
-
// .style("position", "absolute")
|
|
121
|
-
// .style("visibility", "hidden")
|
|
122
|
-
// .style("background-color", "black")
|
|
123
|
-
// .style("border", "solid")
|
|
124
|
-
// .style("border-width", "1px")
|
|
125
|
-
// .style("border-radius", "5px")
|
|
126
|
-
// .style("padding", "10px")
|
|
127
|
-
// .text(nameTool)
|
|
128
|
-
// .style("color", "grey");
|
|
129
|
-
|
|
130
116
|
const ordinalValues = scaleOrdinal().domain(itemName);
|
|
131
117
|
const colorLegend = discreteLegendUtil(
|
|
132
118
|
itemColor,
|
|
133
119
|
useSelectorLegend,
|
|
134
120
|
horizontal
|
|
135
|
-
)
|
|
121
|
+
)
|
|
122
|
+
.inputScale(ordinalValues);
|
|
136
123
|
const currentDiv = select(divRef.current);
|
|
137
124
|
let totalRect;
|
|
138
125
|
|
|
@@ -148,12 +135,6 @@ export const DiscreteColorLegend: React.FC<colorLegendProps> = ({
|
|
|
148
135
|
const svgLegend = currentDiv
|
|
149
136
|
.style("margin", "5px")
|
|
150
137
|
.append("svg")
|
|
151
|
-
// .on("mouseover", function () {
|
|
152
|
-
// return tooltip.style("visibility", "visible");
|
|
153
|
-
// })
|
|
154
|
-
// .on("mouseout", function () {
|
|
155
|
-
// return tooltip.style("visibility", "hidden");
|
|
156
|
-
// })
|
|
157
138
|
.call(colorLegend);
|
|
158
139
|
|
|
159
140
|
// Style for main horizontal legend
|
|
@@ -202,7 +183,7 @@ export const DiscreteColorLegend: React.FC<colorLegendProps> = ({
|
|
|
202
183
|
top: position ? position[1] : " ",
|
|
203
184
|
backgroundColor: "#ffffffcc",
|
|
204
185
|
borderRadius: "5px",
|
|
205
|
-
zIndex:
|
|
186
|
+
zIndex: 999,
|
|
206
187
|
}}
|
|
207
188
|
>
|
|
208
189
|
<div id="legend" ref={divRef}></div>
|
|
@@ -210,18 +191,6 @@ export const DiscreteColorLegend: React.FC<colorLegendProps> = ({
|
|
|
210
191
|
);
|
|
211
192
|
};
|
|
212
193
|
|
|
213
|
-
// Based on name return the colors array from color.tables.json file
|
|
214
|
-
export function colorTableData(
|
|
215
|
-
colorName: string,
|
|
216
|
-
colorTables: colorTablesArray
|
|
217
|
-
): [number, number, number, number][] {
|
|
218
|
-
const colorTableData = colorTables.filter(
|
|
219
|
-
(value: colorTablesObj) =>
|
|
220
|
-
value.name.toLowerCase() == colorName.toLowerCase()
|
|
221
|
-
);
|
|
222
|
-
return colorTableData.length > 0 ? colorTableData[0].colors : [];
|
|
223
|
-
}
|
|
224
|
-
|
|
225
194
|
export function RGBToHex(rgb: number[]) {
|
|
226
195
|
let r = rgb[1].toString(16),
|
|
227
196
|
g = rgb[2].toString(16),
|
|
File without changes
|
|
@@ -3,13 +3,13 @@ import { interpolateRgb } from "d3-interpolate";
|
|
|
3
3
|
import {
|
|
4
4
|
colorTablesArray,
|
|
5
5
|
colorTablesObj,
|
|
6
|
-
} from "../ColorTableTypes";
|
|
6
|
+
} from "../Utils/ColorTableTypes";
|
|
7
7
|
|
|
8
8
|
// Based on objectName return the colors array from color.tables.json file
|
|
9
9
|
export function colorsArray(
|
|
10
10
|
colorName: string,
|
|
11
|
-
colorTables:
|
|
12
|
-
):
|
|
11
|
+
colorTables: any
|
|
12
|
+
): any {
|
|
13
13
|
const colorTableData = colorTables.filter(
|
|
14
14
|
(value: colorTablesObj) =>
|
|
15
15
|
value.name.toLowerCase() == colorName.toLowerCase()
|
|
@@ -4,14 +4,6 @@ declare type ItemColor = {
|
|
|
4
4
|
|
|
5
5
|
// eslint-disable-next-line
|
|
6
6
|
export default function discreteLegendUtil(itemColor: ItemColor[], isSelectorLegend?: boolean, horizontal?: any): any {
|
|
7
|
-
// var cellWidth = 22;
|
|
8
|
-
// var cellHeight = 22;
|
|
9
|
-
|
|
10
|
-
// if (isSelectorLegend) {
|
|
11
|
-
// cellWidth = 25;
|
|
12
|
-
// cellHeight = 22;
|
|
13
|
-
// }
|
|
14
|
-
|
|
15
7
|
const legendValues: ItemColor[] = [];
|
|
16
8
|
|
|
17
9
|
// eslint-disable-next-line
|
|
@@ -19,12 +11,15 @@ export default function discreteLegendUtil(itemColor: ItemColor[], isSelectorLeg
|
|
|
19
11
|
function drawLegend() {
|
|
20
12
|
// Code to fill the color
|
|
21
13
|
// Styling for color selector legend
|
|
22
|
-
//if (isSelectorLegend) {
|
|
23
14
|
g.selectAll("g.legendCells")
|
|
24
15
|
.data(itemColor)
|
|
25
16
|
.enter()
|
|
26
17
|
.append("g")
|
|
27
18
|
.append("rect")
|
|
19
|
+
.append("title")
|
|
20
|
+
.text(function (d: Record<string, unknown>) {
|
|
21
|
+
return d["name"];
|
|
22
|
+
})
|
|
28
23
|
.attr("class", "rectLabel")
|
|
29
24
|
.style("cursor", "pointer")
|
|
30
25
|
.style("pointer-events", "all");
|
|
@@ -36,106 +31,37 @@ export default function discreteLegendUtil(itemColor: ItemColor[], isSelectorLeg
|
|
|
36
31
|
});
|
|
37
32
|
if (horizontal && !isSelectorLegend) {
|
|
38
33
|
g.selectAll("rect")
|
|
39
|
-
.attr("x", function (
|
|
40
|
-
console.log(d)
|
|
34
|
+
.attr("x", function (_d: number, i: number) {
|
|
41
35
|
return i;
|
|
42
36
|
})
|
|
43
37
|
.attr("y", 0);
|
|
44
38
|
} else if (!horizontal && !isSelectorLegend) {
|
|
45
39
|
g.selectAll("rect")
|
|
46
|
-
.attr("y", function (
|
|
47
|
-
console.log(d)
|
|
40
|
+
.attr("y", function (_d: number, i: number) {
|
|
48
41
|
return i;
|
|
49
42
|
})
|
|
50
43
|
.attr("x", 0);
|
|
51
44
|
} else if (horizontal == true && isSelectorLegend) {
|
|
52
45
|
g.selectAll("rect")
|
|
53
|
-
.attr("x", function (
|
|
54
|
-
console.log(d)
|
|
46
|
+
.attr("x", function (_d: number, i: number) {
|
|
55
47
|
return i;
|
|
56
48
|
})
|
|
57
49
|
.attr("y", 0);
|
|
58
50
|
} else if (horizontal == false && isSelectorLegend) {
|
|
59
51
|
g.selectAll("rect")
|
|
60
|
-
.attr("y", function (
|
|
61
|
-
console.log(d)
|
|
52
|
+
.attr("y", function (_d: number, i: number) {
|
|
62
53
|
return i;
|
|
63
54
|
})
|
|
64
55
|
.attr("x", 0);
|
|
65
56
|
} else {
|
|
66
57
|
g.selectAll("rect")
|
|
67
|
-
.attr("x", function (
|
|
68
|
-
console.log(d)
|
|
58
|
+
.attr("x", function (_d: number, i: number) {
|
|
69
59
|
return i;
|
|
70
60
|
})
|
|
71
61
|
.attr("y", 0);
|
|
72
62
|
}
|
|
73
|
-
|
|
74
|
-
// Display the labels for legend
|
|
75
|
-
// g.selectAll("g")
|
|
76
|
-
// .style("background", "grey")
|
|
77
|
-
// .append("text")
|
|
78
|
-
// .attr("class", "breakLabels")
|
|
79
|
-
// .style("font-size", "0.4")
|
|
80
|
-
// //.attr("x", cellWidth + cellPadding)
|
|
81
|
-
// //.attr("y", 5 + cellHeight / 2)
|
|
82
|
-
// .attr("x", function (d: any, i: any) {
|
|
83
|
-
// //console.log(d)
|
|
84
|
-
// return i + "." + 25
|
|
85
|
-
// })
|
|
86
|
-
// .attr("y", 1.5)
|
|
87
|
-
// .text(function (d: any, i: any) {
|
|
88
|
-
// //console.log(d)
|
|
89
|
-
// return i;
|
|
90
|
-
// })
|
|
91
|
-
//}
|
|
92
|
-
// styling for main legend
|
|
93
|
-
// else {
|
|
94
|
-
// itemColor.forEach((item, index) => {
|
|
95
|
-
// legendValues[index].color = item.color;
|
|
96
|
-
// });
|
|
97
|
-
// g.selectAll("g.legendCells")
|
|
98
|
-
// .append("text")
|
|
99
|
-
// .attr("class", "breakLabels")
|
|
100
|
-
// .style("fill", "#6F6F6F")
|
|
101
|
-
// .attr("x", cellWidth + cellPadding)
|
|
102
|
-
// .attr("y", 5 + cellHeight / 2)
|
|
103
|
-
// .text(function (d: Record<string, unknown>, i:any) {
|
|
104
|
-
// return d['label'];
|
|
105
|
-
// });
|
|
106
|
-
// g.selectAll("g.legendCells")
|
|
107
|
-
// .style("cursor", "pointer")
|
|
108
|
-
// .append("rect")
|
|
109
|
-
// .attr("height", cellHeight)
|
|
110
|
-
// .attr("width", cellWidth)
|
|
111
|
-
// .style("fill", function (d: Record<string, unknown>) {
|
|
112
|
-
// //console.log('d', d)
|
|
113
|
-
// return d["color"];
|
|
114
|
-
// })
|
|
115
|
-
|
|
116
|
-
// // Alighment of cell in straight line
|
|
117
|
-
// g.selectAll("g.legendCells").attr(
|
|
118
|
-
// "transform",
|
|
119
|
-
// function (_d: Record<string, unknown>, i: number) {
|
|
120
|
-
// return (
|
|
121
|
-
// "translate(0," + i * (cellHeight + cellPadding) + ")"
|
|
122
|
-
// //"translate(0," + i + ")"
|
|
123
|
-
// );
|
|
124
|
-
// }
|
|
125
|
-
// );
|
|
126
|
-
// }
|
|
127
63
|
}
|
|
128
64
|
|
|
129
|
-
// display the discrete legend
|
|
130
|
-
// if (!isSelectorLegend) {
|
|
131
|
-
// // console.log('itemcolor', itemColor)
|
|
132
|
-
// g.selectAll("g.legendCells")
|
|
133
|
-
// .data(legendValues)
|
|
134
|
-
// .enter()
|
|
135
|
-
// .append("g")
|
|
136
|
-
// .attr("class", "legendCells")
|
|
137
|
-
// }
|
|
138
|
-
|
|
139
65
|
drawLegend();
|
|
140
66
|
}
|
|
141
67
|
// eslint-disable-next-line
|
package/src/index.ts
CHANGED
|
@@ -2,11 +2,11 @@ import { ColorSelectorAccordion } from './component/ColorSelector/ColorSelectorA
|
|
|
2
2
|
import { ColorSelectorComponent } from './component/ColorSelector/ColorSelectorComponent';
|
|
3
3
|
import { ColorSelectorWrapper } from './component/ColorSelector/ColorSelectorWrapper';
|
|
4
4
|
import { ContinuousLegend } from './component/Legend/ContinuousLegend';
|
|
5
|
-
import {
|
|
5
|
+
import { DiscreteColorLegend } from './component/Legend/DiscreteLegend';
|
|
6
6
|
import { ColorLegend } from './component/Legend/ColorLegend';
|
|
7
7
|
import { colorsArray, rgbValues, RGBToHex } from './component/Utils/continousLegend';
|
|
8
8
|
import { d3ColorScales } from './component/Utils/d3ColorScale';
|
|
9
|
-
import { colorTablesObj, colorTablesArray } from './component/ColorTableTypes';
|
|
9
|
+
import { colorTablesObj, colorTablesArray } from './component/Utils/ColorTableTypes';
|
|
10
10
|
import * as colorTables from './component/color-tables.json';
|
|
11
11
|
|
|
12
12
|
export {
|
|
@@ -14,7 +14,6 @@ export {
|
|
|
14
14
|
ColorSelectorComponent,
|
|
15
15
|
ColorSelectorWrapper,
|
|
16
16
|
ContinuousLegend,
|
|
17
|
-
colorTableData,
|
|
18
17
|
DiscreteColorLegend,
|
|
19
18
|
ColorLegend,
|
|
20
19
|
colorsArray,
|
|
@@ -4,7 +4,7 @@ import {ColorLegend} from "../../../component/Legend/ColorLegend";
|
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
component: ColorLegend,
|
|
7
|
-
title: "Legends/
|
|
7
|
+
title: "Legends/LegendWithColorSelector",
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
// prop for continous legend
|
|
@@ -13,7 +13,7 @@ const max = 0.35;
|
|
|
13
13
|
const dataObjectName = "Legend";
|
|
14
14
|
const position = [16, 10];
|
|
15
15
|
const horizontal = true;
|
|
16
|
-
const colorName = "
|
|
16
|
+
const colorName = "Rainbow";
|
|
17
17
|
|
|
18
18
|
// prop for discrete data
|
|
19
19
|
const discreteData = {
|
|
@@ -38,8 +38,8 @@ const Template = (args) => {
|
|
|
38
38
|
return <ColorLegend {...args} />;
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
export const
|
|
42
|
-
|
|
41
|
+
export const LegendWithColorSelector = Template.bind({});
|
|
42
|
+
LegendWithColorSelector.args = {
|
|
43
43
|
min,
|
|
44
44
|
max,
|
|
45
45
|
dataObjectName,
|
package/tsconfig.json
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"noImplicitAny": true,
|
|
15
15
|
"strictNullChecks": true,
|
|
16
16
|
"suppressImplicitAnyIndexErrors": true,
|
|
17
|
-
"noUnusedLocals":
|
|
18
|
-
"noUnusedParameters":
|
|
17
|
+
"noUnusedLocals": false,
|
|
18
|
+
"noUnusedParameters": false,
|
|
19
19
|
"resolveJsonModule": true,
|
|
20
20
|
},
|
|
21
21
|
"include": ["src", "./src/custom.d.ts"],
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ColorTableTypes.js","sourceRoot":"","sources":["../../src/component/ColorTableTypes.ts"],"names":[],"mappings":""}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import React from "react";
|
|
13
|
-
import { DiscreteColorLegend } from "../../../component/Legend/DiscreteLegend";
|
|
14
|
-
import colorTables from "../../../component/color-tables.json";
|
|
15
|
-
export default {
|
|
16
|
-
component: DiscreteColorLegend,
|
|
17
|
-
title: "Legends/DiscreteLegendWithSelector",
|
|
18
|
-
};
|
|
19
|
-
var discreteData = {
|
|
20
|
-
"Above_BCU": [[], 0],
|
|
21
|
-
"ABOVE": [[], 1],
|
|
22
|
-
"H12": [[], 2],
|
|
23
|
-
"H11": [[], 3],
|
|
24
|
-
"H10": [[], 4],
|
|
25
|
-
"H9": [[], 5],
|
|
26
|
-
"H8": [[], 6],
|
|
27
|
-
"H7": [[], 7],
|
|
28
|
-
"H6": [[], 8],
|
|
29
|
-
"H5": [[], 9],
|
|
30
|
-
"H4": [[], 10],
|
|
31
|
-
"H3": [[], 11],
|
|
32
|
-
"H2": [[], 12],
|
|
33
|
-
"H1": [[], 13],
|
|
34
|
-
"BELOW": [[], 14]
|
|
35
|
-
};
|
|
36
|
-
var dataObjectName = "Wells / ZONELOG";
|
|
37
|
-
var position = [16, 10];
|
|
38
|
-
var horizontal = true;
|
|
39
|
-
var colorName = "Stratigraphy";
|
|
40
|
-
var Template = function (args) {
|
|
41
|
-
return React.createElement(DiscreteColorLegend, __assign({}, args));
|
|
42
|
-
};
|
|
43
|
-
export var discreteLegendWithSelector = Template.bind({});
|
|
44
|
-
discreteLegendWithSelector.args = {
|
|
45
|
-
discreteData: discreteData,
|
|
46
|
-
dataObjectName: dataObjectName,
|
|
47
|
-
position: position,
|
|
48
|
-
horizontal: horizontal,
|
|
49
|
-
colorName: colorName,
|
|
50
|
-
colorTables: colorTables,
|
|
51
|
-
};
|
|
52
|
-
//# sourceMappingURL=DiscreteLegendWithSelector.stories.js.map
|
package/dist/stories/ColorLegends/LegendWithSelector/DiscreteLegendWithSelector.stories.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DiscreteLegendWithSelector.stories.js","sourceRoot":"","sources":["../../../../src/stories/ColorLegends/LegendWithSelector/DiscreteLegendWithSelector.stories.jsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,WAAW,MAAM,sCAAsC,CAAC;A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cAAA;IACZ,cAAc,gBAAA;IACd,QAAQ,UAAA;IACR,UAAU,YAAA;IACV,SAAS,WAAA;IACT,WAAW,aAAA;CACd,CAAC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import React from "react";
|
|
13
|
-
import { ContinuousLegend } from "../../../component/Legend/ContinuousLegend";
|
|
14
|
-
import colorTables from "../../../component/color-tables.json";
|
|
15
|
-
export default {
|
|
16
|
-
component: ContinuousLegend,
|
|
17
|
-
title: "Legends/LegendWithSelector",
|
|
18
|
-
};
|
|
19
|
-
var min = 0;
|
|
20
|
-
var max = 0.35;
|
|
21
|
-
var dataObjectName = "Legend";
|
|
22
|
-
var position = [16, 10];
|
|
23
|
-
var horizontal = true;
|
|
24
|
-
var colorName = "Time/Depth";
|
|
25
|
-
var Template = function (args) {
|
|
26
|
-
return React.createElement(ContinuousLegend, __assign({}, args));
|
|
27
|
-
};
|
|
28
|
-
export var legendWithSelector = Template.bind({});
|
|
29
|
-
legendWithSelector.args = {
|
|
30
|
-
min: min,
|
|
31
|
-
max: max,
|
|
32
|
-
dataObjectName: dataObjectName,
|
|
33
|
-
position: position,
|
|
34
|
-
horizontal: horizontal,
|
|
35
|
-
colorName: colorName,
|
|
36
|
-
colorTables: colorTables,
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=LegendWithSelector.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LegendWithSelector.stories.js","sourceRoot":"","sources":["../../../../src/stories/ColorLegends/LegendWithSelector/LegendWithSelector.stories.jsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,WAAW,MAAM,sCAAsC,CAAC;AAE/D,eAAe;IACX,SAAS,EAAE,gBAAgB;IAC3B,KAAK,EAAE,4BAA4B;CACtC,CAAC;AAEF,IAAM,GAAG,GAAG,CAAC,CAAC;AACd,IAAM,GAAG,GAAG,IAAI,CAAC;AACjB,IAAM,cAAc,GAAG,QAAQ,CAAC;AAChC,IAAM,QAAQ,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC1B,IAAM,UAAU,GAAG,IAAI,CAAC;AACxB,IAAM,SAAS,GAAG,YAAY,CAAC;AAE/B,IAAM,QAAQ,GAAG,UAAC,IAAI;IAClB,OAAO,oBAAC,gBAAgB,eAAK,IAAI,EAAI,CAAC;AAC1C,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,kBAAkB,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACpD,kBAAkB,CAAC,IAAI,GAAG;IACtB,GAAG,KAAA;IACH,GAAG,KAAA;IACH,cAAc,gBAAA;IACd,QAAQ,UAAA;IACR,UAAU,YAAA;IACV,SAAS,WAAA;IACT,WAAW,aAAA;CACd,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Single.stories.js","sourceRoot":"","sources":["../../../../src/stories/ColorLegends/SingleComponent/Single.stories.jsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,WAAW,MAAM,sCAAsC,CAAC;AAC/D,OAAO,EAAC,WAAW,EAAC,MAAM,uCAAuC,CAAC;AAElE,eAAe;IACX,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,yBAAyB;CACnC,CAAC;AAEF,4BAA4B;AAC5B,I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IACH,GAAG,KAAA;IACH,cAAc,gBAAA;IACd,QAAQ,UAAA;IACR,UAAU,YAAA;IACV,SAAS,WAAA;IACT,WAAW,aAAA;IACX,YAAY,cAAA;CACf,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { DiscreteColorLegend } from "../../../component/Legend/DiscreteLegend";
|
|
3
|
-
import colorTables from "../../../component/color-tables.json";
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
component: DiscreteColorLegend,
|
|
7
|
-
title: "Legends/DiscreteLegendWithSelector",
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const discreteData = {
|
|
11
|
-
"Above_BCU": [[], 0],
|
|
12
|
-
"ABOVE": [[], 1],
|
|
13
|
-
"H12": [[], 2],
|
|
14
|
-
"H11": [[], 3],
|
|
15
|
-
"H10": [[], 4],
|
|
16
|
-
"H9": [[], 5],
|
|
17
|
-
"H8": [[], 6],
|
|
18
|
-
"H7": [[], 7],
|
|
19
|
-
"H6": [[], 8],
|
|
20
|
-
"H5": [[], 9],
|
|
21
|
-
"H4": [[], 10],
|
|
22
|
-
"H3": [[], 11],
|
|
23
|
-
"H2": [[], 12],
|
|
24
|
-
"H1": [[], 13],
|
|
25
|
-
"BELOW": [[], 14]
|
|
26
|
-
};
|
|
27
|
-
const dataObjectName = "Wells / ZONELOG";
|
|
28
|
-
const position = [16, 10];
|
|
29
|
-
const horizontal = true;
|
|
30
|
-
const colorName = "Stratigraphy";
|
|
31
|
-
|
|
32
|
-
const Template = (args) => {
|
|
33
|
-
return <DiscreteColorLegend {...args} />;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const discreteLegendWithSelector = Template.bind({});
|
|
37
|
-
discreteLegendWithSelector.args = {
|
|
38
|
-
discreteData,
|
|
39
|
-
dataObjectName,
|
|
40
|
-
position,
|
|
41
|
-
horizontal,
|
|
42
|
-
colorName,
|
|
43
|
-
colorTables,
|
|
44
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { ContinuousLegend } from "../../../component/Legend/ContinuousLegend";
|
|
3
|
-
import colorTables from "../../../component/color-tables.json";
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
component: ContinuousLegend,
|
|
7
|
-
title: "Legends/LegendWithSelector",
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const min = 0;
|
|
11
|
-
const max = 0.35;
|
|
12
|
-
const dataObjectName = "Legend";
|
|
13
|
-
const position = [16, 10];
|
|
14
|
-
const horizontal = true;
|
|
15
|
-
const colorName = "Time/Depth";
|
|
16
|
-
|
|
17
|
-
const Template = (args) => {
|
|
18
|
-
return <ContinuousLegend {...args} />;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const legendWithSelector = Template.bind({});
|
|
22
|
-
legendWithSelector.args = {
|
|
23
|
-
min,
|
|
24
|
-
max,
|
|
25
|
-
dataObjectName,
|
|
26
|
-
position,
|
|
27
|
-
horizontal,
|
|
28
|
-
colorName,
|
|
29
|
-
colorTables,
|
|
30
|
-
};
|