@emerson-eps/color-tables 0.1.7 → 0.1.12
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/ColorTableTypes.d.ts +6 -0
- package/dist/component/ColorTableTypes.js +2 -0
- package/dist/component/ColorTableTypes.js.map +1 -0
- package/dist/component/Legend/ContinuousLegend.d.ts +15 -0
- package/dist/component/Legend/ContinuousLegend.js +89 -0
- package/dist/component/Legend/ContinuousLegend.js.map +1 -0
- package/dist/component/Legend/DiscreteLegend.d.ts +17 -0
- package/dist/component/Legend/DiscreteLegend.js +80 -0
- package/dist/component/Legend/DiscreteLegend.js.map +1 -0
- package/dist/component/Utils/continousLegend.d.ts +13 -0
- package/dist/component/Utils/continousLegend.js +50 -0
- package/dist/component/Utils/continousLegend.js.map +1 -0
- package/dist/component/Utils/discreteLegend.d.ts +5 -0
- package/dist/component/Utils/discreteLegend.js +60 -0
- package/dist/component/Utils/discreteLegend.js.map +1 -0
- package/dist/component/WelllayerTemplateTypes.d.ts +13 -0
- package/dist/component/WelllayerTemplateTypes.js +2 -0
- package/dist/component/WelllayerTemplateTypes.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/stories/ColorLegends/ContinousLgends/MD.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/ContinousLgends/MD.stories.js +29 -0
- package/dist/stories/ColorLegends/ContinousLgends/MD.stories.js.map +1 -0
- package/dist/stories/ColorLegends/ContinousLgends/NTG.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/ContinousLgends/NTG.stories.js +29 -0
- package/dist/stories/ColorLegends/ContinousLgends/NTG.stories.js.map +1 -0
- package/dist/stories/ColorLegends/ContinousLgends/PermTot.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/ContinousLgends/PermTot.stories.js +29 -0
- package/dist/stories/ColorLegends/ContinousLgends/PermTot.stories.js.map +1 -0
- package/dist/stories/ColorLegends/ContinousLgends/Permeability.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/ContinousLgends/Permeability.stories.js +29 -0
- package/dist/stories/ColorLegends/ContinousLgends/Permeability.stories.js.map +1 -0
- package/dist/stories/ColorLegends/ContinousLgends/PoroTot.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/ContinousLgends/PoroTot.stories.js +29 -0
- package/dist/stories/ColorLegends/ContinousLgends/PoroTot.stories.js.map +1 -0
- package/dist/stories/ColorLegends/ContinousLgends/Porosity.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/ContinousLgends/Porosity.stories.js +29 -0
- package/dist/stories/ColorLegends/ContinousLgends/Porosity.stories.js.map +1 -0
- package/dist/stories/ColorLegends/ContinousLgends/SW.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/ContinousLgends/SW.stories.js +29 -0
- package/dist/stories/ColorLegends/ContinousLgends/SW.stories.js.map +1 -0
- package/dist/stories/ColorLegends/DiscreteLegends/Facies.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/DiscreteLegends/Facies.stories.js +38 -0
- package/dist/stories/ColorLegends/DiscreteLegends/Facies.stories.js.map +1 -0
- package/dist/stories/ColorLegends/DiscreteLegends/FaciesNoCalcite.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/DiscreteLegends/FaciesNoCalcite.stories.js +38 -0
- package/dist/stories/ColorLegends/DiscreteLegends/FaciesNoCalcite.stories.js.map +1 -0
- package/dist/stories/ColorLegends/DiscreteLegends/FaultDistanceHum.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/DiscreteLegends/FaultDistanceHum.stories.js +30 -0
- package/dist/stories/ColorLegends/DiscreteLegends/FaultDistanceHum.stories.js.map +1 -0
- package/dist/stories/ColorLegends/DiscreteLegends/FaultProximityFlag.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/DiscreteLegends/FaultProximityFlag.stories.js +30 -0
- package/dist/stories/ColorLegends/DiscreteLegends/FaultProximityFlag.stories.js.map +1 -0
- package/dist/stories/ColorLegends/DiscreteLegends/RDE.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/DiscreteLegends/RDE.stories.js +33 -0
- package/dist/stories/ColorLegends/DiscreteLegends/RDE.stories.js.map +1 -0
- package/dist/stories/ColorLegends/DiscreteLegends/RDE_Orig.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/DiscreteLegends/RDE_Orig.stories.js +44 -0
- package/dist/stories/ColorLegends/DiscreteLegends/RDE_Orig.stories.js.map +1 -0
- package/dist/stories/ColorLegends/DiscreteLegends/ZoneMain.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/DiscreteLegends/ZoneMain.stories.js +33 -0
- package/dist/stories/ColorLegends/DiscreteLegends/ZoneMain.stories.js.map +1 -0
- package/dist/stories/ColorLegends/DiscreteLegends/Zonelog.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/DiscreteLegends/Zonelog.stories.js +43 -0
- package/dist/stories/ColorLegends/DiscreteLegends/Zonelog.stories.js.map +1 -0
- package/package.json +9 -7
- package/src/component/Legend/ContinuousLegend.tsx +4 -6
- package/src/component/Legend/DiscreteLegend.tsx +2 -4
- package/src/component/color-tables.json +15 -1
- package/src/component/welllayer_template.json +1 -1
- package/src/custom.d.ts +1 -0
- package/src/index.ts +6 -0
- package/src/stories/ColorLegends/ContinousLgends/MD.stories.jsx +1 -1
- package/src/stories/ColorLegends/ContinousLgends/NTG.stories.jsx +1 -1
- package/src/stories/ColorLegends/ContinousLgends/PermTot.stories.jsx +1 -1
- package/src/stories/ColorLegends/ContinousLgends/Permeability.stories.jsx +1 -1
- package/src/stories/ColorLegends/ContinousLgends/PoroTot.stories.jsx +1 -1
- package/src/stories/ColorLegends/ContinousLgends/Porosity.stories.jsx +1 -1
- package/src/stories/ColorLegends/ContinousLgends/SW.stories.jsx +1 -1
- package/src/stories/ColorLegends/DiscreteLegends/Facies.stories.jsx +1 -1
- package/src/stories/ColorLegends/DiscreteLegends/FaciesNoCalcite.stories.jsx +1 -1
- package/src/stories/ColorLegends/DiscreteLegends/FaultDistanceHum.stories.jsx +1 -1
- package/src/stories/ColorLegends/DiscreteLegends/FaultProximityFlag.stories.jsx +1 -1
- package/src/stories/ColorLegends/DiscreteLegends/RDE.stories.jsx +1 -1
- package/src/stories/ColorLegends/DiscreteLegends/RDE_Orig.stories.jsx +1 -1
- package/src/stories/ColorLegends/DiscreteLegends/ZoneMain.stories.jsx +1 -1
- package/src/stories/ColorLegends/DiscreteLegends/Zonelog.stories.jsx +1 -1
- package/tsconfig.json +24 -0
- package/src/index.js +0 -2
- package/src/setupTests.js +0 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorTableTypes.js","sourceRoot":"","sources":["../../src/component/ColorTableTypes.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { templateArray } from "../WelllayerTemplateTypes";
|
|
3
|
+
import { colorTablesArray } from "../ColorTableTypes";
|
|
4
|
+
declare type legendProps = {
|
|
5
|
+
min: number;
|
|
6
|
+
max: number;
|
|
7
|
+
dataObjectName: string;
|
|
8
|
+
position: number[];
|
|
9
|
+
name: string;
|
|
10
|
+
template: templateArray;
|
|
11
|
+
colorTables: colorTablesArray;
|
|
12
|
+
horizontal: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare const ContinuousLegend: React.FC<legendProps>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { RGBToHex, colorsArray } from "../Utils/continousLegend";
|
|
3
|
+
import { select, scaleLinear, scaleSequential, axisBottom } from "d3";
|
|
4
|
+
export const ContinuousLegend = ({ min, max, dataObjectName, position, name, template, colorTables, horizontal, }) => {
|
|
5
|
+
React.useEffect(() => {
|
|
6
|
+
continuousLegend("#legend");
|
|
7
|
+
}, [min, max, template, colorTables, horizontal]);
|
|
8
|
+
function continuousLegend(selected_id) {
|
|
9
|
+
const itemColor = [];
|
|
10
|
+
// Return the matched colors array from color.tables.json file
|
|
11
|
+
const colorTableColors = colorsArray(name, template, colorTables);
|
|
12
|
+
colorTableColors.forEach((value) => {
|
|
13
|
+
// return the color and offset needed to draw the legend
|
|
14
|
+
itemColor.push({
|
|
15
|
+
offset: RGBToHex(value).offset,
|
|
16
|
+
color: RGBToHex(value).color,
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
select(selected_id).select("svg").remove();
|
|
20
|
+
const colorScale = scaleSequential().domain([min, max]);
|
|
21
|
+
// append a defs (for definition) element to your SVG
|
|
22
|
+
const svgLegend = select(selected_id)
|
|
23
|
+
.append("svg")
|
|
24
|
+
.style("background-color", "#ffffffcc")
|
|
25
|
+
.style("border-radius", "5px");
|
|
26
|
+
if (!horizontal) {
|
|
27
|
+
svgLegend
|
|
28
|
+
.style("transform", "rotate(270deg)")
|
|
29
|
+
.style("margin-top", "80px");
|
|
30
|
+
}
|
|
31
|
+
const defs = svgLegend.append("defs");
|
|
32
|
+
// append a linearGradient element to the defs and give it a unique id
|
|
33
|
+
const linearGradient = defs
|
|
34
|
+
.append("linearGradient")
|
|
35
|
+
.attr("id", "linear-gradient")
|
|
36
|
+
.attr("x1", "0%")
|
|
37
|
+
.attr("x2", "100%") //since it's a horizontal linear gradient
|
|
38
|
+
.attr("y1", "0%")
|
|
39
|
+
.attr("y2", "0%");
|
|
40
|
+
// append multiple color stops by using D3's data/enter step
|
|
41
|
+
linearGradient
|
|
42
|
+
.selectAll("stop")
|
|
43
|
+
.data(itemColor)
|
|
44
|
+
.enter()
|
|
45
|
+
.append("stop")
|
|
46
|
+
.attr("offset", function (data) {
|
|
47
|
+
return data.offset + "%";
|
|
48
|
+
})
|
|
49
|
+
.attr("stop-color", function (data) {
|
|
50
|
+
return data.color;
|
|
51
|
+
});
|
|
52
|
+
// append title
|
|
53
|
+
svgLegend
|
|
54
|
+
.append("text")
|
|
55
|
+
.attr("class", "legendTitle")
|
|
56
|
+
.attr("x", 25)
|
|
57
|
+
.attr("y", 20)
|
|
58
|
+
.style("text-anchor", "left")
|
|
59
|
+
.text(dataObjectName);
|
|
60
|
+
// draw the rectangle and fill with gradient
|
|
61
|
+
svgLegend
|
|
62
|
+
.append("rect")
|
|
63
|
+
.attr("x", 25)
|
|
64
|
+
.attr("y", 30)
|
|
65
|
+
.attr("width", 250)
|
|
66
|
+
.attr("height", 25)
|
|
67
|
+
.style("fill", "url(#linear-gradient)");
|
|
68
|
+
//create tick marks
|
|
69
|
+
const xLeg = scaleLinear().domain([min, max]).range([10, 258]);
|
|
70
|
+
const axisLeg = axisBottom(xLeg).tickValues(colorScale.domain());
|
|
71
|
+
svgLegend
|
|
72
|
+
.attr("class", "axis")
|
|
73
|
+
.append("g")
|
|
74
|
+
.attr("transform", "translate(15, 55)")
|
|
75
|
+
.style("font-size", "10px")
|
|
76
|
+
.style("font-weight", "700")
|
|
77
|
+
.call(axisLeg);
|
|
78
|
+
}
|
|
79
|
+
return (React.createElement("div", { style: {
|
|
80
|
+
position: "absolute",
|
|
81
|
+
right: position[0],
|
|
82
|
+
top: position[1],
|
|
83
|
+
} },
|
|
84
|
+
React.createElement("div", { id: "legend" })));
|
|
85
|
+
};
|
|
86
|
+
ContinuousLegend.defaultProps = {
|
|
87
|
+
position: [5, 10],
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=ContinuousLegend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContinuousLegend.js","sourceRoot":"","sources":["../../../src/component/Legend/ContinuousLegend.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAoBtE,MAAM,CAAC,MAAM,gBAAgB,GAA0B,CAAC,EACpD,GAAG,EACH,GAAG,EACH,cAAc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M,IAAI,GAAG,WAAW,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC;QAE/D,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;QAEjE,SAAS;aACJ,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC;aACrB,MAAM,CAAC,GAAG,CAAC;aACX,IAAI,CAAC,WAAW,EAAE,mBAAmB,CAAC;aACtC,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC;aAC1B,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC;aAC3B,IAAI,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IAED,OAAO,CACH,6BACI,KAAK,EAAE;YACH,QAAQ,EAAE,UAAU;YACpB,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;YAClB,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;SACnB;QAED,6BAAK,EAAE,EAAC,QAAQ,GAAO,CACrB,CACT,CAAC;AACN,CAAC,CAAC;AAEF,gBAAgB,CAAC,YAAY,GAAG;IAC5B,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { templateArray } from "../WelllayerTemplateTypes";
|
|
3
|
+
import { colorTablesArray } from "../ColorTableTypes";
|
|
4
|
+
declare type colorLegendProps = {
|
|
5
|
+
discreteData: {
|
|
6
|
+
objects: Record<string, [number[], number]>;
|
|
7
|
+
};
|
|
8
|
+
dataObjectName: string;
|
|
9
|
+
name: string;
|
|
10
|
+
position: number[];
|
|
11
|
+
template: templateArray;
|
|
12
|
+
colorTables: colorTablesArray;
|
|
13
|
+
horizontal: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare const DiscreteColorLegend: React.FC<colorLegendProps>;
|
|
16
|
+
export declare function colorTableData(name: string, template: templateArray, colorTables: colorTablesArray): [number, number, number, number][];
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import legendUtil from "../Utils/discreteLegend";
|
|
3
|
+
import { scaleOrdinal, select } from "d3";
|
|
4
|
+
export const DiscreteColorLegend = ({ discreteData, name, dataObjectName, position, template, colorTables, horizontal, }) => {
|
|
5
|
+
React.useEffect(() => {
|
|
6
|
+
discreteLegend("#legend");
|
|
7
|
+
}, [discreteData, template, colorTables, horizontal]);
|
|
8
|
+
function discreteLegend(legend) {
|
|
9
|
+
const itemName = [];
|
|
10
|
+
const itemColor = [];
|
|
11
|
+
const colorsArray = colorTableData(name, template, colorTables);
|
|
12
|
+
Object.keys(discreteData).forEach((key) => {
|
|
13
|
+
// eslint-disable-next-line
|
|
14
|
+
let code = discreteData[key][1];
|
|
15
|
+
// compare the first value in colorarray(colortable) and code from discreteData
|
|
16
|
+
const matchedColorsArrays = colorsArray.find((value) => {
|
|
17
|
+
return value[0] == code;
|
|
18
|
+
});
|
|
19
|
+
if (matchedColorsArrays)
|
|
20
|
+
itemColor.push({
|
|
21
|
+
color: RGBToHex(matchedColorsArrays),
|
|
22
|
+
});
|
|
23
|
+
itemName.push(key);
|
|
24
|
+
});
|
|
25
|
+
function RGBToHex(rgb) {
|
|
26
|
+
let r = rgb[1].toString(16), g = rgb[2].toString(16), b = rgb[3].toString(16);
|
|
27
|
+
if (r.length == 1)
|
|
28
|
+
r = "0" + r;
|
|
29
|
+
if (g.length == 1)
|
|
30
|
+
g = "0" + g;
|
|
31
|
+
if (b.length == 1)
|
|
32
|
+
b = "0" + b;
|
|
33
|
+
return "#" + r + g + b;
|
|
34
|
+
}
|
|
35
|
+
const ordinalValues = scaleOrdinal().domain(itemName);
|
|
36
|
+
const colorLegend = legendUtil(itemColor).inputScale(ordinalValues);
|
|
37
|
+
select(legend).select("svg").remove();
|
|
38
|
+
const legendLength = itemColor.length;
|
|
39
|
+
const calcLegendHeight = 22 * legendLength + 4 * legendLength;
|
|
40
|
+
const selectedLegend = select(legend);
|
|
41
|
+
if (!horizontal)
|
|
42
|
+
selectedLegend.style("height", 150 + "px");
|
|
43
|
+
const svgLegend = selectedLegend
|
|
44
|
+
.append("svg")
|
|
45
|
+
.style("margin", "10px 10px")
|
|
46
|
+
.call(colorLegend);
|
|
47
|
+
if (colorLegend && horizontal) {
|
|
48
|
+
svgLegend
|
|
49
|
+
.attr("height", calcLegendHeight + "px")
|
|
50
|
+
.attr("width", 220 + "px");
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
svgLegend
|
|
54
|
+
.style("transform", "rotate(90deg)")
|
|
55
|
+
.attr("width", calcLegendHeight + "px")
|
|
56
|
+
.attr("height", calcLegendHeight + "px");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return (React.createElement("div", { style: {
|
|
60
|
+
position: "absolute",
|
|
61
|
+
right: position[0],
|
|
62
|
+
top: position[1],
|
|
63
|
+
backgroundColor: "#ffffffcc",
|
|
64
|
+
borderRadius: "5px",
|
|
65
|
+
} },
|
|
66
|
+
React.createElement("label", { style: { color: "#6F6F6F", margin: "10px 10px" } }, dataObjectName),
|
|
67
|
+
React.createElement("div", { id: "legend" })));
|
|
68
|
+
};
|
|
69
|
+
// Based on name return the colors array from color.tables.json file
|
|
70
|
+
export function colorTableData(name, template, colorTables) {
|
|
71
|
+
const properties = template[0]["properties"];
|
|
72
|
+
const propertiesData = properties.filter((value) => value.objectName == name);
|
|
73
|
+
const colorTableData = colorTables.filter((value) => value.name.toLowerCase() ==
|
|
74
|
+
propertiesData[0].colorTable.toLowerCase());
|
|
75
|
+
return colorTableData[0].colors;
|
|
76
|
+
}
|
|
77
|
+
DiscreteColorLegend.defaultProps = {
|
|
78
|
+
position: [5, 10],
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=DiscreteLegend.js.map
|
|
@@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CAAC,CAAC,UAAU,CAAC,WAAW,EAAE,CACjD,CAAC;IACF,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;AACpC,CAAC;AAED,mBAAmB,CAAC,YAAY,GAAG;IAC/B,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { colorTablesArray } from "../ColorTableTypes";
|
|
2
|
+
import { templateArray } from "../WelllayerTemplateTypes";
|
|
3
|
+
export declare function colorsArray(objectName: string, template: templateArray, colorTables: colorTablesArray): [number, number, number, number][];
|
|
4
|
+
export declare function rgbValues(objectName: string, point: number, template: templateArray, colorTables: colorTablesArray): number[] | {
|
|
5
|
+
r: number;
|
|
6
|
+
g: number;
|
|
7
|
+
b: number;
|
|
8
|
+
opacity: number;
|
|
9
|
+
} | undefined;
|
|
10
|
+
export declare function RGBToHex(rgb: number[]): {
|
|
11
|
+
color: string;
|
|
12
|
+
offset: number;
|
|
13
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { color } from "d3-color";
|
|
2
|
+
import { interpolateRgb } from "d3-interpolate";
|
|
3
|
+
// Based on objectName return the colors array from color.tables.json file
|
|
4
|
+
export function colorsArray(objectName, template, colorTables) {
|
|
5
|
+
const properties = template[0]["properties"];
|
|
6
|
+
const propertiesData = properties.filter((value) => value.objectName == objectName);
|
|
7
|
+
const colorTableData = colorTables.filter((value) => value.name.toLowerCase() ==
|
|
8
|
+
propertiesData[0].colorTable.toLowerCase());
|
|
9
|
+
return colorTableData[0].colors;
|
|
10
|
+
}
|
|
11
|
+
// return the colors based on the point
|
|
12
|
+
export function rgbValues(objectName, point, template, colorTables) {
|
|
13
|
+
var _a;
|
|
14
|
+
const colorTableColors = colorsArray(objectName, template, colorTables);
|
|
15
|
+
// compare the point and first value from colorTableColors
|
|
16
|
+
const colorArrays = colorTableColors.find((value) => {
|
|
17
|
+
return point == value[0];
|
|
18
|
+
});
|
|
19
|
+
// if point and value in color table matches then return particular colors
|
|
20
|
+
if (colorArrays) {
|
|
21
|
+
return colorArrays.slice(1);
|
|
22
|
+
}
|
|
23
|
+
// if no match then need to do interpolation
|
|
24
|
+
else {
|
|
25
|
+
// Get index of first match of colortable point greater than point
|
|
26
|
+
const index = colorTableColors.findIndex((value) => {
|
|
27
|
+
return value[0] > point;
|
|
28
|
+
});
|
|
29
|
+
const firstColorArray = colorTableColors[index - 1];
|
|
30
|
+
const secondColorArray = colorTableColors[index];
|
|
31
|
+
if ((firstColorArray || secondColorArray) != undefined) {
|
|
32
|
+
const interpolatedValues = interpolateRgb(RGBToHex(firstColorArray).color, RGBToHex(secondColorArray).color)(point);
|
|
33
|
+
return (_a = color(interpolatedValues)) === null || _a === void 0 ? void 0 : _a.rgb();
|
|
34
|
+
}
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// return the hex color code and offset
|
|
39
|
+
export function RGBToHex(rgb) {
|
|
40
|
+
let r = Math.round(rgb[1]).toString(16), g = Math.round(rgb[2]).toString(16), b = Math.round(rgb[3]).toString(16);
|
|
41
|
+
if (r.length == 1)
|
|
42
|
+
r = "0" + r;
|
|
43
|
+
if (g.length == 1)
|
|
44
|
+
g = "0" + g;
|
|
45
|
+
if (b.length == 1)
|
|
46
|
+
b = "0" + b;
|
|
47
|
+
const offset = rgb[0] * 100.0;
|
|
48
|
+
return { color: "#" + r + g + b, offset: offset };
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=continousLegend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"continousLegend.js","sourceRoot":"","sources":["../../../src/component/Utils/continousLegend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAUhD,0EAA0E;AAC1E,MAAM,UAAU,WAAW,CACvB,UAAkB,EAClB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|
|
3
|
+
let legendValues = [];
|
|
4
|
+
const cellWidth = 22;
|
|
5
|
+
const cellHeight = 22;
|
|
6
|
+
const cellPadding = 4;
|
|
7
|
+
// eslint-disable-next-line
|
|
8
|
+
function legend(g) {
|
|
9
|
+
function drawLegend() {
|
|
10
|
+
itemColor.forEach((item, index) => {
|
|
11
|
+
legendValues[index].color = item.color;
|
|
12
|
+
});
|
|
13
|
+
// Code to fill the color
|
|
14
|
+
g.selectAll("g.legendCells")
|
|
15
|
+
.append("rect")
|
|
16
|
+
.attr("height", cellHeight)
|
|
17
|
+
.attr("width", cellWidth)
|
|
18
|
+
.style("stroke", "black")
|
|
19
|
+
.style("stroke-width", "1px")
|
|
20
|
+
.style("fill", function (d) {
|
|
21
|
+
return d["color"];
|
|
22
|
+
});
|
|
23
|
+
// Display the label
|
|
24
|
+
g.selectAll("g.legendCells")
|
|
25
|
+
.append("text")
|
|
26
|
+
.attr("class", "breakLabels")
|
|
27
|
+
.style("fill", "#6F6F6F")
|
|
28
|
+
.attr("x", cellWidth + cellPadding)
|
|
29
|
+
.attr("y", 5 + cellHeight / 2)
|
|
30
|
+
.text(function (d) {
|
|
31
|
+
return d["label"];
|
|
32
|
+
});
|
|
33
|
+
// Alighment of cell in straight line
|
|
34
|
+
g.selectAll("g.legendCells").attr("transform", function (_d, i) {
|
|
35
|
+
return ("translate(0," + i * (cellHeight + cellPadding) + ")");
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
// display the discrete legend
|
|
39
|
+
g.selectAll("g.legendCells")
|
|
40
|
+
.data(legendValues)
|
|
41
|
+
.enter()
|
|
42
|
+
.append("g")
|
|
43
|
+
.attr("class", "legendCells");
|
|
44
|
+
drawLegend();
|
|
45
|
+
}
|
|
46
|
+
// eslint-disable-next-line
|
|
47
|
+
legend.inputScale = function (newScale) {
|
|
48
|
+
// eslint-disable-next-line
|
|
49
|
+
let scale = {};
|
|
50
|
+
scale = newScale;
|
|
51
|
+
legendValues = [];
|
|
52
|
+
scale.domain().forEach(function (el) {
|
|
53
|
+
const cellObject = { color: scale(el), label: el };
|
|
54
|
+
legendValues.push(cellObject);
|
|
55
|
+
});
|
|
56
|
+
return this;
|
|
57
|
+
};
|
|
58
|
+
return legend;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=discreteLegend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discreteLegend.js","sourceRoot":"","sources":["../../../src/component/Utils/discreteLegend.ts"],"names":[],"mappings":"AAIA,2BAA2B;AAC3B,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,SAAsB;IACrD,IAAI,YAAY,GAAgB,EAAE,CAAC;IACnC,MAAM,SAAS,GAAG,EAAE,CAAC;IACrB,MAAM,UAAU,GAAG,EAAE,CAAC;IACtB,MAAM,WAAW,GAAG,CAAC,CAAC;IAEtB,2BAA2B;IAC3B,SAAS,MAAM,CAAC,CAAM;QAClB,SAAS,UAAU;YACf,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;gBAC9B,YAAY,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;YAC3C,CAAC,CAAC,CAAC;YACH,yBAAyB;YACzB,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC;iBACvB,MAAM,CAAC,MAAM,CAAC;iBACd,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC;iBAC1B,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC;iBACxB,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC;iBACxB,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC;iBAC5B,KAAK,CAAC,MAAM,EAAE,UAAU,CAA0B;gBAC/C,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC;YACtB,CAAC,CAAC,CAAC;YACP,oBAAoB;YACpB,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC;iBACvB,MAAM,CAAC,MAAM,CAAC;iBACd,IAAI,CAA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C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare type propertiesObj = {
|
|
2
|
+
objectName: string;
|
|
3
|
+
colorTable: string;
|
|
4
|
+
context: string;
|
|
5
|
+
colorInterpolation: string;
|
|
6
|
+
};
|
|
7
|
+
declare type propertiesArr = Array<propertiesObj>;
|
|
8
|
+
declare type template = {
|
|
9
|
+
name: string;
|
|
10
|
+
properties: propertiesArr;
|
|
11
|
+
};
|
|
12
|
+
export declare type templateArray = Array<template>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WelllayerTemplateTypes.js","sourceRoot":"","sources":["../../src/component/WelllayerTemplateTypes.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { ContinuousLegend } from './component/Legend/ContinuousLegend';
|
|
2
|
+
export { colorTableData, DiscreteColorLegend } from './component/Legend/DiscreteLegend';
|
|
3
|
+
export { colorsArray, rgbValues, RGBToHex } from './component/Utils/continousLegend';
|
|
4
|
+
export { colorTablesObj, colorTablesArray } from './component/ColorTableTypes';
|
|
5
|
+
export { propertiesObj, templateArray } from './component/WelllayerTemplateTypes';
|
|
6
|
+
export declare const colorTables: any;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ContinuousLegend } from './component/Legend/ContinuousLegend';
|
|
2
|
+
export { colorTableData, DiscreteColorLegend } from './component/Legend/DiscreteLegend';
|
|
3
|
+
export { colorsArray, rgbValues, RGBToHex } from './component/Utils/continousLegend';
|
|
4
|
+
export const colorTables = require('./component/color-tables');
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,mCAAmC,CAAC;AAGpF,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ContinuousLegend } from "../../../component/Legend/ContinuousLegend";
|
|
3
|
+
export default {
|
|
4
|
+
component: ContinuousLegend,
|
|
5
|
+
title: "Legends/ContinousLegend",
|
|
6
|
+
};
|
|
7
|
+
import template from "../../../component/welllayer_template.json";
|
|
8
|
+
import colorTables from "../../../component/color-tables.json";
|
|
9
|
+
const min = 2918;
|
|
10
|
+
const max = 4770;
|
|
11
|
+
const dataObjectName = "Wells / MD";
|
|
12
|
+
const position = [16, 10];
|
|
13
|
+
const name = "MD";
|
|
14
|
+
const horizontal = true;
|
|
15
|
+
const Template = (args) => {
|
|
16
|
+
return React.createElement(ContinuousLegend, Object.assign({}, args));
|
|
17
|
+
};
|
|
18
|
+
export const MDTemplate = Template.bind({});
|
|
19
|
+
MDTemplate.args = {
|
|
20
|
+
min,
|
|
21
|
+
max,
|
|
22
|
+
dataObjectName,
|
|
23
|
+
position,
|
|
24
|
+
name,
|
|
25
|
+
template,
|
|
26
|
+
colorTables,
|
|
27
|
+
horizontal,
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=MD.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MD.stories.js","sourceRoot":"","sources":["../../../../src/stories/ColorLegends/ContinousLgends/MD.stories.jsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,gBAAgB,EAAC,MAAM,4CAA4C,CAAC;AAC5E,eAAe;IACX,SAAS,EAAE,gBAAgB;IAC3B,KAAK,EAAE,yBAAyB;CACnC,CAAC;AACF,OAAO,QAAQ,MAAM,4CAA4C,CAAC;AAClE,OAAO,WAAW,MAAM,sCAAsC,CAAC;AAE/D,MAAM,GAAG,GAAG,IAAI,CAAC;AACjB,MAAM,GAAG,GAAG,IAAI,CAAC;AACjB,MAAM,cAAc,GAAG,YAAY,CAAC;AACpC,MAAM,QAAQ,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC1B,MAAM,IAAI,GAAG,IAAI,CAAC;AAClB,MAAM,UAAU,GAAG,IAAI,CAAC;AAExB,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,EAAE;IACtB,OAAO,oBAAC,gBAAgB,oBAAK,IAAI,EAAI,CAAC;AAC1C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC5C,UAAU,CAAC,IAAI,GAAG;IACd,GAAG;IACH,GAAG;IACH,cAAc;IACd,QAAQ;IACR,IAAI;IACJ,QAAQ;IACR,WAAW;IACX,UAAU;CACb,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ContinuousLegend } from "../../../component/Legend/ContinuousLegend";
|
|
3
|
+
export default {
|
|
4
|
+
component: ContinuousLegend,
|
|
5
|
+
title: "Legends/ContinousLegend",
|
|
6
|
+
};
|
|
7
|
+
import template from "../../../component/welllayer_template.json";
|
|
8
|
+
import colorTables from "../../../component/color-tables.json";
|
|
9
|
+
const min = 0;
|
|
10
|
+
const max = 1;
|
|
11
|
+
const dataObjectName = "Wells / NTG";
|
|
12
|
+
const position = [16, 10];
|
|
13
|
+
const name = "NTG";
|
|
14
|
+
const horizontal = true;
|
|
15
|
+
const Template = (args) => {
|
|
16
|
+
return React.createElement(ContinuousLegend, Object.assign({}, args));
|
|
17
|
+
};
|
|
18
|
+
export const NTGTemplate = Template.bind({});
|
|
19
|
+
NTGTemplate.args = {
|
|
20
|
+
min,
|
|
21
|
+
max,
|
|
22
|
+
dataObjectName,
|
|
23
|
+
position,
|
|
24
|
+
name,
|
|
25
|
+
template,
|
|
26
|
+
colorTables,
|
|
27
|
+
horizontal,
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=NTG.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NTG.stories.js","sourceRoot":"","sources":["../../../../src/stories/ColorLegends/ContinousLgends/NTG.stories.jsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,gBAAgB,EAAC,MAAM,4CAA4C,CAAC;AAC5E,eAAe;IACX,SAAS,EAAE,gBAAgB;IAC3B,KAAK,EAAE,yBAAyB;CACnC,CAAC;AACF,OAAO,QAAQ,MAAM,4CAA4C,CAAC;AAClE,OAAO,WAAW,MAAM,sCAAsC,CAAC;AAE/D,MAAM,GAAG,GAAG,CAAC,CAAC;AACd,MAAM,GAAG,GAAG,CAAC,CAAC;AACd,MAAM,cAAc,GAAG,aAAa,CAAC;AACrC,MAAM,QAAQ,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC1B,MAAM,IAAI,GAAG,KAAK,CAAC;AACnB,MAAM,UAAU,GAAG,IAAI,CAAC;AAExB,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,EAAE;IACtB,OAAO,oBAAC,gBAAgB,oBAAK,IAAI,EAAI,CAAC;AAC1C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC7C,WAAW,CAAC,IAAI,GAAG;IACf,GAAG;IACH,GAAG;IACH,cAAc;IACd,QAAQ;IACR,IAAI;IACJ,QAAQ;IACR,WAAW;IACX,UAAU;CACb,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ContinuousLegend } from "../../../component/Legend/ContinuousLegend";
|
|
3
|
+
export default {
|
|
4
|
+
component: ContinuousLegend,
|
|
5
|
+
title: "Legends/ContinousLegend",
|
|
6
|
+
};
|
|
7
|
+
import template from "../../../component/welllayer_template.json";
|
|
8
|
+
import colorTables from "../../../component/color-tables.json";
|
|
9
|
+
const min = -999;
|
|
10
|
+
const max = 14023;
|
|
11
|
+
const dataObjectName = "Wells / PERMTOT";
|
|
12
|
+
const position = [16, 10];
|
|
13
|
+
const name = "PERM_TOT";
|
|
14
|
+
const horizontal = true;
|
|
15
|
+
const Template = (args) => {
|
|
16
|
+
return React.createElement(ContinuousLegend, Object.assign({}, args));
|
|
17
|
+
};
|
|
18
|
+
export const PermTotTemplate = Template.bind({});
|
|
19
|
+
PermTotTemplate.args = {
|
|
20
|
+
min,
|
|
21
|
+
max,
|
|
22
|
+
dataObjectName,
|
|
23
|
+
position,
|
|
24
|
+
name,
|
|
25
|
+
template,
|
|
26
|
+
colorTables,
|
|
27
|
+
horizontal,
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=PermTot.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PermTot.stories.js","sourceRoot":"","sources":["../../../../src/stories/ColorLegends/ContinousLgends/PermTot.stories.jsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,gBAAgB,EAAC,MAAM,4CAA4C,CAAC;AAC5E,eAAe;IACX,SAAS,EAAE,gBAAgB;IAC3B,KAAK,EAAE,yBAAyB;CACnC,CAAC;AACF,OAAO,QAAQ,MAAM,4CAA4C,CAAC;AAClE,OAAO,WAAW,MAAM,sCAAsC,CAAC;AAE/D,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC;AACjB,MAAM,GAAG,GAAG,KAAK,CAAC;AAClB,MAAM,cAAc,GAAG,iBAAiB,CAAC;AACzC,MAAM,QAAQ,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC1B,MAAM,IAAI,GAAG,UAAU,CAAC;AACxB,MAAM,UAAU,GAAG,IAAI,CAAC;AAExB,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,EAAE;IACtB,OAAO,oBAAC,gBAAgB,oBAAK,IAAI,EAAI,CAAC;AAC1C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACjD,eAAe,CAAC,IAAI,GAAG;IACnB,GAAG;IACH,GAAG;IACH,cAAc;IACd,QAAQ;IACR,IAAI;IACJ,QAAQ;IACR,WAAW;IACX,UAAU;CACb,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ContinuousLegend } from "../../../component/Legend/ContinuousLegend";
|
|
3
|
+
export default {
|
|
4
|
+
component: ContinuousLegend,
|
|
5
|
+
title: "Legends/ContinousLegend",
|
|
6
|
+
};
|
|
7
|
+
import template from "../../../component/welllayer_template.json";
|
|
8
|
+
import colorTables from "../../../component/color-tables.json";
|
|
9
|
+
const min = -999;
|
|
10
|
+
const max = 14023;
|
|
11
|
+
const dataObjectName = "Wells / PERM";
|
|
12
|
+
const position = [16, 10];
|
|
13
|
+
const name = "PERM";
|
|
14
|
+
const horizontal = true;
|
|
15
|
+
const Template = (args) => {
|
|
16
|
+
return React.createElement(ContinuousLegend, Object.assign({}, args));
|
|
17
|
+
};
|
|
18
|
+
export const PermeabilityTemplate = Template.bind({});
|
|
19
|
+
PermeabilityTemplate.args = {
|
|
20
|
+
min,
|
|
21
|
+
max,
|
|
22
|
+
dataObjectName,
|
|
23
|
+
position,
|
|
24
|
+
name,
|
|
25
|
+
template,
|
|
26
|
+
colorTables,
|
|
27
|
+
horizontal,
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=Permeability.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Permeability.stories.js","sourceRoot":"","sources":["../../../../src/stories/ColorLegends/ContinousLgends/Permeability.stories.jsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,gBAAgB,EAAC,MAAM,4CAA4C,CAAC;AAC5E,eAAe;IACX,SAAS,EAAE,gBAAgB;IAC3B,KAAK,EAAE,yBAAyB;CACnC,CAAC;AACF,OAAO,QAAQ,MAAM,4CAA4C,CAAC;AAClE,OAAO,WAAW,MAAM,sCAAsC,CAAC;AAE/D,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC;AACjB,MAAM,GAAG,GAAG,KAAK,CAAC;AAClB,MAAM,cAAc,GAAG,cAAc,CAAC;AACtC,MAAM,QAAQ,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC1B,MAAM,IAAI,GAAG,MAAM,CAAC;AACpB,MAAM,UAAU,GAAG,IAAI,CAAC;AAExB,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,EAAE;IACtB,OAAO,oBAAC,gBAAgB,oBAAK,IAAI,EAAI,CAAC;AAC1C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACtD,oBAAoB,CAAC,IAAI,GAAG;IACxB,GAAG;IACH,GAAG;IACH,cAAc;IACd,QAAQ;IACR,IAAI;IACJ,QAAQ;IACR,WAAW;IACX,UAAU;CACb,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ContinuousLegend } from "../../../component/Legend/ContinuousLegend";
|
|
3
|
+
export default {
|
|
4
|
+
component: ContinuousLegend,
|
|
5
|
+
title: "Legends/ContinousLegend",
|
|
6
|
+
};
|
|
7
|
+
import template from "../../../component/welllayer_template.json";
|
|
8
|
+
import colorTables from "../../../component/color-tables.json";
|
|
9
|
+
const min = 0;
|
|
10
|
+
const max = 0.35;
|
|
11
|
+
const dataObjectName = "Wells / POROTOT";
|
|
12
|
+
const position = [16, 10];
|
|
13
|
+
const name = "PORO";
|
|
14
|
+
const horizontal = true;
|
|
15
|
+
const Template = (args) => {
|
|
16
|
+
return React.createElement(ContinuousLegend, Object.assign({}, args));
|
|
17
|
+
};
|
|
18
|
+
export const PoroTotTemplate = Template.bind({});
|
|
19
|
+
PoroTotTemplate.args = {
|
|
20
|
+
min,
|
|
21
|
+
max,
|
|
22
|
+
dataObjectName,
|
|
23
|
+
position,
|
|
24
|
+
name,
|
|
25
|
+
template,
|
|
26
|
+
colorTables,
|
|
27
|
+
horizontal,
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=PoroTot.stories.js.map
|