@emerson-eps/color-tables 0.1.21 → 0.2.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.
Files changed (69) hide show
  1. package/dist/component/ColorSelector/ColorSelectorComponent.d.ts +7 -0
  2. package/dist/component/ColorSelector/ColorSelectorComponent.js +62 -0
  3. package/dist/component/ColorSelector/ColorSelectorComponent.js.map +1 -0
  4. package/dist/component/ColorSelector/ColorTableSelectorWrapper.d.ts +2 -0
  5. package/dist/component/ColorSelector/ColorTableSelectorWrapper.js +25 -0
  6. package/dist/component/ColorSelector/ColorTableSelectorWrapper.js.map +1 -0
  7. package/dist/component/ColorSelector/legendComponent.d.ts +14 -0
  8. package/dist/component/ColorSelector/legendComponent.js +228 -0
  9. package/dist/component/ColorSelector/legendComponent.js.map +1 -0
  10. package/dist/component/Legend/ContinuousLegend.d.ts +2 -2
  11. package/dist/component/Legend/ContinuousLegend.js +2 -2
  12. package/dist/component/Legend/ContinuousLegend.js.map +1 -1
  13. package/dist/component/Legend/DiscreteLegend.d.ts +2 -2
  14. package/dist/component/Legend/DiscreteLegend.js +4 -4
  15. package/dist/component/Legend/DiscreteLegend.js.map +1 -1
  16. package/dist/component/Utils/d3ColorScale.d.ts +10 -0
  17. package/dist/component/Utils/d3ColorScale.js +84 -0
  18. package/dist/component/Utils/d3ColorScale.js.map +1 -0
  19. package/dist/component/Utils/discreteLegend.d.ts +2 -2
  20. package/dist/component/Utils/discreteLegend.js +26 -15
  21. package/dist/component/Utils/discreteLegend.js.map +1 -1
  22. package/dist/stories/ColorLegends/ColorSelector/Selector.stories.d.ts +7 -0
  23. package/dist/stories/ColorLegends/ColorSelector/Selector.stories.js +11 -0
  24. package/dist/stories/ColorLegends/ColorSelector/Selector.stories.js.map +1 -0
  25. package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/MD.stories.d.ts +0 -0
  26. package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/MD.stories.js +0 -2
  27. package/dist/stories/ColorLegends/ContinousLegends/MD.stories.js.map +1 -0
  28. package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/NTG.stories.d.ts +0 -0
  29. package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/NTG.stories.js +0 -2
  30. package/dist/stories/ColorLegends/ContinousLegends/NTG.stories.js.map +1 -0
  31. package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/PermTot.stories.d.ts +0 -0
  32. package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/PermTot.stories.js +0 -2
  33. package/dist/stories/ColorLegends/ContinousLegends/PermTot.stories.js.map +1 -0
  34. package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/Permeability.stories.d.ts +0 -0
  35. package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/Permeability.stories.js +0 -2
  36. package/dist/stories/ColorLegends/ContinousLegends/Permeability.stories.js.map +1 -0
  37. package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/PoroTot.stories.d.ts +0 -0
  38. package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/PoroTot.stories.js +0 -2
  39. package/dist/stories/ColorLegends/ContinousLegends/PoroTot.stories.js.map +1 -0
  40. package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/Porosity.stories.d.ts +0 -0
  41. package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/Porosity.stories.js +0 -2
  42. package/dist/stories/ColorLegends/ContinousLegends/Porosity.stories.js.map +1 -0
  43. package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/SW.stories.d.ts +0 -0
  44. package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/SW.stories.js +2 -4
  45. package/dist/stories/ColorLegends/ContinousLegends/SW.stories.js.map +1 -0
  46. package/package.json +3 -1
  47. package/src/component/ColorSelector/ColorSelectorComponent.tsx +109 -0
  48. package/src/component/ColorSelector/ColorTableSelectorWrapper.tsx +49 -0
  49. package/src/component/ColorSelector/legendComponent.tsx +289 -0
  50. package/src/component/Legend/ContinuousLegend.tsx +4 -4
  51. package/src/component/Legend/DiscreteLegend.tsx +6 -6
  52. package/src/component/Utils/d3ColorScale.ts +84 -0
  53. package/src/component/Utils/discreteLegend.ts +34 -23
  54. package/src/stories/ColorLegends/ColorSelector/Selector.stories.jsx +12 -0
  55. package/src/stories/ColorLegends/{ContinousLgends → ContinousLegends}/MD.stories.jsx +0 -2
  56. package/src/stories/ColorLegends/{ContinousLgends → ContinousLegends}/NTG.stories.jsx +0 -2
  57. package/src/stories/ColorLegends/{ContinousLgends → ContinousLegends}/PermTot.stories.jsx +0 -2
  58. package/src/stories/ColorLegends/{ContinousLgends → ContinousLegends}/Permeability.stories.jsx +0 -2
  59. package/src/stories/ColorLegends/{ContinousLgends → ContinousLegends}/PoroTot.stories.jsx +0 -2
  60. package/src/stories/ColorLegends/{ContinousLgends → ContinousLegends}/Porosity.stories.jsx +0 -2
  61. package/src/stories/ColorLegends/{ContinousLgends → ContinousLegends}/SW.stories.jsx +2 -4
  62. package/tsconfig.json +1 -1
  63. package/dist/stories/ColorLegends/ContinousLgends/MD.stories.js.map +0 -1
  64. package/dist/stories/ColorLegends/ContinousLgends/NTG.stories.js.map +0 -1
  65. package/dist/stories/ColorLegends/ContinousLgends/PermTot.stories.js.map +0 -1
  66. package/dist/stories/ColorLegends/ContinousLgends/Permeability.stories.js.map +0 -1
  67. package/dist/stories/ColorLegends/ContinousLgends/PoroTot.stories.js.map +0 -1
  68. package/dist/stories/ColorLegends/ContinousLgends/Porosity.stories.js.map +0 -1
  69. package/dist/stories/ColorLegends/ContinousLgends/SW.stories.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  // eslint-disable-next-line
2
- export default function legendUtil(itemColor) {
2
+ export default function discreteLegendUtil(itemColor, ColorSelector) {
3
3
  let legendValues = [];
4
4
  const cellWidth = 22;
5
5
  const cellHeight = 22;
@@ -15,25 +15,36 @@ export default function legendUtil(itemColor) {
15
15
  .append("rect")
16
16
  .attr("height", cellHeight)
17
17
  .attr("width", cellWidth)
18
- .style("stroke", "black")
19
- .style("stroke-width", "1px")
20
18
  .style("fill", function (d) {
21
19
  return d["color"];
22
20
  });
21
+ if (!ColorSelector) {
22
+ g.selectAll("g.legendCells.rect").style("stroke", "black").style("stroke-width", "1px");
23
+ }
23
24
  // 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
- });
25
+ if (!ColorSelector) {
26
+ g.selectAll("g.legendCells")
27
+ .append("text")
28
+ .attr("class", "breakLabels")
29
+ .style("fill", "#6F6F6F")
30
+ .attr("x", cellWidth + cellPadding)
31
+ .attr("y", 5 + cellHeight / 2)
32
+ .text(function (d) {
33
+ return d["label"];
34
+ });
35
+ }
33
36
  // 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
+ if (!ColorSelector) {
38
+ g.selectAll("g.legendCells").attr("transform", function (_d, i) {
39
+ return ("translate(0," + i * (cellHeight + cellPadding) + ")");
40
+ });
41
+ }
42
+ if (ColorSelector) {
43
+ g.selectAll("g.legendCells")
44
+ .attr("transform", function (d) {
45
+ return "translate(" + (d.label * cellWidth) + ",0)";
46
+ });
47
+ }
37
48
  }
38
49
  // display the discrete legend
39
50
  g.selectAll("g.legendCells")
@@ -1 +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;IAC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AAa,EAAE;gBACf,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC;qBAC3B,IAAI,CAAC,WAAW,EAAE,UAAS,CAAM;oBAC9B,OAAO,YAAY,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,SAAS,CAAC,GAAG,KAAK,CAAA;gBAAC,CAAC,CACxD,CAAC;aACL;QACL,CAAC;QACD,8BAA8B;QAC9B,CAAC,CAAC,SAAS,CAAC,eAAe,CAAC;aACvB,IAAI,CAAC,YAAY,CAAC;aAClB,KAAK,EAAE;aACP,MAAM,CAAC,GAAG,CAAC;aACX,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;QAClC,UAAU,EAAE,CAAC;IACjB,CAAC;IACD,2BAA2B;IAC3B,MAAM,CAAC,UAAU,GAAG,UAAU,QAAa;QACvC,2BAA2B;QAC3B,IAAI,KAAK,GAAQ,EAAE,CAAC;QACpB,KAAK,GAAG,QAAQ,CAAC;QACjB,YAAY,GAAG,EAAE,CAAC;QAClB,KAAK,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,UAAU,EAAU;YACvC,MAAM,UAAU,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;YACnD,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IAChB,CAAC,CAAC;IACF,OAAO,MAAM,CAAC;AAClB,CAAC"}
@@ -0,0 +1,7 @@
1
+ declare namespace _default {
2
+ export { ColorSelectorWrapper as component };
3
+ export const title: string;
4
+ }
5
+ export default _default;
6
+ export const selectorTemplate: any;
7
+ import { ColorSelectorWrapper } from "../../../component/ColorSelector/ColorTableSelectorWrapper";
@@ -0,0 +1,11 @@
1
+ import * as React from "react";
2
+ import { ColorSelectorWrapper } from "../../../component/ColorSelector/ColorTableSelectorWrapper";
3
+ export default {
4
+ component: ColorSelectorWrapper,
5
+ title: "Legends/ColorSelector",
6
+ };
7
+ const Template = (args) => {
8
+ return React.createElement(ColorSelectorWrapper, null);
9
+ };
10
+ export const selectorTemplate = Template.bind({});
11
+ //# sourceMappingURL=Selector.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Selector.stories.js","sourceRoot":"","sources":["../../../../src/stories/ColorLegends/ColorSelector/Selector.stories.jsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAC;AAClG,eAAe;IACX,SAAS,EAAE,oBAAoB;IAC/B,KAAK,EAAE,uBAAuB;CACjC,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,EAAE;IACtB,OAAO,oBAAC,oBAAoB,OAAG,CAAC;AACpC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC"}
@@ -9,7 +9,6 @@ const min = 2918;
9
9
  const max = 4770;
10
10
  const dataObjectName = "Wells / MD";
11
11
  const position = [16, 10];
12
- const name = "MD";
13
12
  const horizontal = true;
14
13
  const colorName = "Time/Depth";
15
14
  const Template = (args) => {
@@ -21,7 +20,6 @@ MDTemplate.args = {
21
20
  max,
22
21
  dataObjectName,
23
22
  position,
24
- name,
25
23
  colorName,
26
24
  colorTables,
27
25
  horizontal,
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MD.stories.js","sourceRoot":"","sources":["../../../../src/stories/ColorLegends/ContinousLegends/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,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,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,SAAS,GAAG,YAAY,CAAC;AAE/B,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,SAAS;IACT,WAAW;IACX,UAAU;CACb,CAAC"}
@@ -9,7 +9,6 @@ const min = 0;
9
9
  const max = 1;
10
10
  const dataObjectName = "Wells / NTG";
11
11
  const position = [16, 10];
12
- const name = "NTG";
13
12
  const horizontal = true;
14
13
  const colorName = "Rainbow";
15
14
  const Template = (args) => {
@@ -21,7 +20,6 @@ NTGTemplate.args = {
21
20
  max,
22
21
  dataObjectName,
23
22
  position,
24
- name,
25
23
  colorName,
26
24
  colorTables,
27
25
  horizontal,
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NTG.stories.js","sourceRoot":"","sources":["../../../../src/stories/ColorLegends/ContinousLegends/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,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,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,SAAS,GAAG,SAAS,CAAC;AAE5B,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,SAAS;IACT,WAAW;IACX,UAAU;CACb,CAAC"}
@@ -9,7 +9,6 @@ const min = -999;
9
9
  const max = 14023;
10
10
  const dataObjectName = "Wells / PERMTOT";
11
11
  const position = [16, 10];
12
- const name = "PERM_TOT";
13
12
  const horizontal = true;
14
13
  const colorName = "Porosity";
15
14
  const Template = (args) => {
@@ -21,7 +20,6 @@ PermTotTemplate.args = {
21
20
  max,
22
21
  dataObjectName,
23
22
  position,
24
- name,
25
23
  colorName,
26
24
  colorTables,
27
25
  horizontal,
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PermTot.stories.js","sourceRoot":"","sources":["../../../../src/stories/ColorLegends/ContinousLegends/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,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,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,SAAS,GAAG,UAAU,CAAC;AAE7B,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,SAAS;IACT,WAAW;IACX,UAAU;CACb,CAAC"}
@@ -9,7 +9,6 @@ const min = -999;
9
9
  const max = 14023;
10
10
  const dataObjectName = "Wells / PERM";
11
11
  const position = [16, 10];
12
- const name = "PERM";
13
12
  const horizontal = true;
14
13
  const colorName = "Permeability";
15
14
  const Template = (args) => {
@@ -21,7 +20,6 @@ PermeabilityTemplate.args = {
21
20
  max,
22
21
  dataObjectName,
23
22
  position,
24
- name,
25
23
  colorName,
26
24
  colorTables,
27
25
  horizontal,
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Permeability.stories.js","sourceRoot":"","sources":["../../../../src/stories/ColorLegends/ContinousLegends/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,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,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,SAAS,GAAG,cAAc,CAAC;AAEjC,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,SAAS;IACT,WAAW;IACX,UAAU;CACb,CAAC"}
@@ -9,7 +9,6 @@ const min = 0;
9
9
  const max = 0.35;
10
10
  const dataObjectName = "Wells / POROTOT";
11
11
  const position = [16, 10];
12
- const name = "PORO";
13
12
  const horizontal = true;
14
13
  const colorName = "Porosity";
15
14
  const Template = (args) => {
@@ -21,7 +20,6 @@ PoroTotTemplate.args = {
21
20
  max,
22
21
  dataObjectName,
23
22
  position,
24
- name,
25
23
  colorName,
26
24
  colorTables,
27
25
  horizontal,
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PoroTot.stories.js","sourceRoot":"","sources":["../../../../src/stories/ColorLegends/ContinousLegends/PoroTot.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,WAAW,MAAM,sCAAsC,CAAC;AAE/D,MAAM,GAAG,GAAG,CAAC,CAAC;AACd,MAAM,GAAG,GAAG,IAAI,CAAC;AACjB,MAAM,cAAc,GAAG,iBAAiB,CAAC;AACzC,MAAM,QAAQ,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC1B,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,SAAS,GAAG,UAAU,CAAC;AAE7B,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,SAAS;IACT,WAAW;IACX,UAAU;CACb,CAAC"}
@@ -9,7 +9,6 @@ const min = 0;
9
9
  const max = 0.35;
10
10
  const dataObjectName = "Wells / PORO";
11
11
  const position = [16, 10];
12
- const name = "PORO";
13
12
  const horizontal = true;
14
13
  const colorName = "Porosity";
15
14
  const Template = (args) => {
@@ -21,7 +20,6 @@ PorosityTemplate.args = {
21
20
  max,
22
21
  dataObjectName,
23
22
  position,
24
- name,
25
23
  colorName,
26
24
  colorTables,
27
25
  horizontal,
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Porosity.stories.js","sourceRoot":"","sources":["../../../../src/stories/ColorLegends/ContinousLegends/Porosity.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,WAAW,MAAM,sCAAsC,CAAC;AAE/D,MAAM,GAAG,GAAG,CAAC,CAAC;AACd,MAAM,GAAG,GAAG,IAAI,CAAC;AACjB,MAAM,cAAc,GAAG,cAAc,CAAC;AACtC,MAAM,QAAQ,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC1B,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,SAAS,GAAG,UAAU,CAAC;AAE7B,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,EAAE;IACtB,OAAO,oBAAC,gBAAgB,oBAAK,IAAI,EAAI,CAAC;AAC1C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAClD,gBAAgB,CAAC,IAAI,GAAG;IACpB,GAAG;IACH,GAAG;IACH,cAAc;IACd,QAAQ;IACR,SAAS;IACT,WAAW;IACX,UAAU;CACb,CAAC"}
@@ -9,9 +9,8 @@ const min = 0;
9
9
  const max = 1;
10
10
  const dataObjectName = "Wells / SW";
11
11
  const position = [16, 10];
12
- const name = "SW";
13
12
  const horizontal = true;
14
- const colorName = "Physics";
13
+ const colorName = "Rainbow";
15
14
  const Template = (args) => {
16
15
  return React.createElement(ContinuousLegend, Object.assign({}, args));
17
16
  };
@@ -21,8 +20,7 @@ SWTemplate.args = {
21
20
  max,
22
21
  dataObjectName,
23
22
  position,
24
- name,
25
- Physics,
23
+ colorName,
26
24
  colorTables,
27
25
  horizontal,
28
26
  };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SW.stories.js","sourceRoot":"","sources":["../../../../src/stories/ColorLegends/ContinousLegends/SW.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,WAAW,MAAM,sCAAsC,CAAC;AAE/D,MAAM,GAAG,GAAG,CAAC,CAAC;AACd,MAAM,GAAG,GAAG,CAAC,CAAC;AACd,MAAM,cAAc,GAAG,YAAY,CAAC;AACpC,MAAM,QAAQ,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC1B,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,SAAS,GAAG,SAAS,CAAC;AAE5B,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,SAAS;IACT,WAAW;IACX,UAAU;CACb,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emerson-eps/color-tables",
3
- "version": "0.1.21",
3
+ "version": "0.2.1",
4
4
  "description": "Standard library of color tables for geological domain",
5
5
  "release": {
6
6
  "branches": [
@@ -16,6 +16,7 @@
16
16
  "semantic-release": "semantic-release"
17
17
  },
18
18
  "dependencies": {
19
+ "@equinor/eds-core-react": "^0.17.0",
19
20
  "d3": "^7.2.0",
20
21
  "d3-color": "^3.0.1",
21
22
  "d3-interpolate": "^3.0.1",
@@ -57,6 +58,7 @@
57
58
  "@testing-library/react": "^12.1.2",
58
59
  "@testing-library/user-event": "^13.5.0",
59
60
  "@types/d3": "^7.1.0",
61
+ "@types/styled-components": "^5.1.23",
60
62
  "babel-loader": "^8.1.0",
61
63
  "semantic-release": "^19.0.2",
62
64
  "ts-loader": "^9.2.6",
@@ -0,0 +1,109 @@
1
+ import * as React from "react";
2
+ import * as colorTables from "../color-tables.json";
3
+ import {d3ColorScales} from "../Utils/d3ColorScale"
4
+ import {LegendComponent} from "./legendComponent";
5
+
6
+ const position = [16, 206];
7
+ const continuosColorData: any = []
8
+ const continuosD3ColorData: any = []
9
+ const discreteColorData: any = []
10
+ const discreteD3ColorData: any = []
11
+
12
+ interface legendProps {
13
+ useColorTableColors: boolean
14
+ useD3Colors: boolean
15
+ }
16
+
17
+ // code is for color table continuous data
18
+ var colorTableContinuousData = colorTables.filter((element: any) => {
19
+ return element.discrete == false;
20
+ });
21
+
22
+ colorTableContinuousData.forEach((element: any) => {
23
+ continuosColorData.push({color: element.colors, name: element.name})
24
+ });
25
+
26
+ // code is for d3 continuous data
27
+ var d3continuousData = d3ColorScales.filter((element: any) => {
28
+ return element.discrete == false;
29
+ });
30
+
31
+ d3continuousData.forEach((element: any) => {
32
+ continuosD3ColorData.push({color: element.colors, name: element.name})
33
+ });
34
+
35
+ // code is for color table discrete data
36
+ var discreteData = colorTables.filter((element: any) => {
37
+ return element.discrete == true;
38
+ });
39
+
40
+ discreteData.forEach((element: any) => {
41
+ discreteColorData.push({color: element.colors, name: element.name})
42
+ });
43
+
44
+ // code is for color table d3 discrete data
45
+ var d3discreteData = d3ColorScales.filter((element: any) => {
46
+ return element.discrete == true;
47
+ });
48
+
49
+ d3discreteData.forEach((element: any) => {
50
+ discreteD3ColorData.push({color: element.colors, name: element.name})
51
+ });
52
+
53
+ export const ColorSelector: React.FC<legendProps> = ({
54
+ useColorTableColors,
55
+ useD3Colors,
56
+ }: legendProps) => {
57
+ let continuousLegend;
58
+ let discreteLegend;
59
+
60
+ if (useColorTableColors) {
61
+ continuousLegend = continuosColorData.map((value: any, key: any) => {
62
+ return <div>
63
+ <LegendComponent
64
+ position={position + key}
65
+ colorsObject={value}
66
+ legendColor={''}
67
+ legendColorName={''}
68
+ useContColorTable={true}
69
+ valueIndex={key}
70
+ />
71
+ </div>
72
+ });
73
+
74
+ discreteLegend = discreteColorData.map((val: any, key: any) => {
75
+ return <LegendComponent
76
+ legendColorName={val.name}
77
+ position={position}
78
+ colorsObject={discreteColorData[key]}
79
+ useDiscColorTable={true} />
80
+ });
81
+ }
82
+ if (useD3Colors) {
83
+ continuousLegend = continuosD3ColorData.map((val: any, key: any) => {
84
+ return <LegendComponent
85
+ position={position + key}
86
+ colorsObject={{}}
87
+ legendColor={val.color}
88
+ legendColorName={val.name}
89
+ useContColorTable={false}
90
+ valueIndex={key + "0"}
91
+ />
92
+ });
93
+
94
+ discreteLegend = d3discreteData.map((val: any) => {
95
+ return <LegendComponent
96
+ legendColorName={val.name}
97
+ position={position}
98
+ colorsObject={val.colors}
99
+ useDiscColorTable={false} />
100
+ });
101
+ }
102
+
103
+ return (
104
+ <div>
105
+ {continuousLegend}
106
+ {discreteLegend}
107
+ </div>
108
+ );
109
+ };
@@ -0,0 +1,49 @@
1
+ import * as React from "react";
2
+ import { Accordion } from "@equinor/eds-core-react";
3
+ import { ColorSelector } from "./ColorSelectorComponent";
4
+
5
+ export const ColorSelectorWrapper = () => {
6
+ return (
7
+ <div style={{width: "650px"}}>
8
+ <Accordion >
9
+ <Accordion.Item>
10
+ <Accordion.Header>
11
+ Color Scales
12
+ </Accordion.Header>
13
+ <Accordion.Panel>
14
+ <Accordion >
15
+ <Accordion.Item>
16
+ <Accordion.Header>
17
+ Geologic Color Scale
18
+ </Accordion.Header>
19
+ <Accordion.Panel>
20
+ <ColorSelector useColorTableColors={true} useD3Colors={false}/>
21
+ </Accordion.Panel>
22
+ </Accordion.Item>
23
+ </Accordion>
24
+ <Accordion >
25
+ <Accordion.Item>
26
+ <Accordion.Header>
27
+ D3 Color Scale
28
+ </Accordion.Header>
29
+ <Accordion.Panel>
30
+ <ColorSelector useColorTableColors={false} useD3Colors={true}/>
31
+ </Accordion.Panel>
32
+ </Accordion.Item>
33
+ </Accordion>
34
+ <Accordion >
35
+ <Accordion.Item>
36
+ <Accordion.Header>
37
+ Custom Color Scale
38
+ </Accordion.Header>
39
+ <Accordion.Panel>
40
+ Custom Content
41
+ </Accordion.Panel>
42
+ </Accordion.Item>
43
+ </Accordion>
44
+ </Accordion.Panel>
45
+ </Accordion.Item>
46
+ </Accordion>
47
+ </div>
48
+ );
49
+ };