@emerson-eps/color-tables 0.1.20 → 0.2.0

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 (60) hide show
  1. package/dist/component/ColorSelector/ColorSelectorComponent.d.ts +7 -0
  2. package/dist/component/ColorSelector/ColorSelectorComponent.js +36 -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 +27 -0
  6. package/dist/component/ColorSelector/ColorTableSelectorWrapper.js.map +1 -0
  7. package/dist/component/ColorTableTypes.d.ts +1 -1
  8. package/dist/component/Legend/ContinuousLegend.d.ts +2 -2
  9. package/dist/component/Legend/ContinuousLegend.js +14 -7
  10. package/dist/component/Legend/ContinuousLegend.js.map +1 -1
  11. package/dist/component/Legend/DiscreteLegend.d.ts +2 -2
  12. package/dist/component/Legend/DiscreteLegend.js +16 -10
  13. package/dist/component/Legend/DiscreteLegend.js.map +1 -1
  14. package/dist/component/Legend/legendContinous.d.ts +11 -0
  15. package/dist/component/Legend/legendContinous.js +132 -0
  16. package/dist/component/Legend/legendContinous.js.map +1 -0
  17. package/dist/component/Utils/d3ColorScale.d.ts +7 -0
  18. package/dist/component/Utils/d3ColorScale.js +38 -0
  19. package/dist/component/Utils/d3ColorScale.js.map +1 -0
  20. package/dist/stories/ColorLegends/ColorSelector/Selector.stories.d.ts +7 -0
  21. package/dist/stories/ColorLegends/ColorSelector/Selector.stories.js +11 -0
  22. package/dist/stories/ColorLegends/ColorSelector/Selector.stories.js.map +1 -0
  23. package/dist/stories/ColorLegends/ContinousLegends/MD.stories.d.ts +7 -0
  24. package/dist/stories/ColorLegends/ContinousLegends/MD.stories.js +27 -0
  25. package/dist/stories/ColorLegends/ContinousLegends/MD.stories.js.map +1 -0
  26. package/dist/stories/ColorLegends/ContinousLegends/NTG.stories.d.ts +7 -0
  27. package/dist/stories/ColorLegends/ContinousLegends/NTG.stories.js +27 -0
  28. package/dist/stories/ColorLegends/ContinousLegends/NTG.stories.js.map +1 -0
  29. package/dist/stories/ColorLegends/ContinousLegends/PermTot.stories.d.ts +7 -0
  30. package/dist/stories/ColorLegends/ContinousLegends/PermTot.stories.js +27 -0
  31. package/dist/stories/ColorLegends/ContinousLegends/PermTot.stories.js.map +1 -0
  32. package/dist/stories/ColorLegends/ContinousLegends/Permeability.stories.d.ts +7 -0
  33. package/dist/stories/ColorLegends/ContinousLegends/Permeability.stories.js +27 -0
  34. package/dist/stories/ColorLegends/ContinousLegends/Permeability.stories.js.map +1 -0
  35. package/dist/stories/ColorLegends/ContinousLegends/PoroTot.stories.d.ts +7 -0
  36. package/dist/stories/ColorLegends/ContinousLegends/PoroTot.stories.js +27 -0
  37. package/dist/stories/ColorLegends/ContinousLegends/PoroTot.stories.js.map +1 -0
  38. package/dist/stories/ColorLegends/ContinousLegends/Porosity.stories.d.ts +7 -0
  39. package/dist/stories/ColorLegends/ContinousLegends/Porosity.stories.js +27 -0
  40. package/dist/stories/ColorLegends/ContinousLegends/Porosity.stories.js.map +1 -0
  41. package/dist/stories/ColorLegends/ContinousLegends/SW.stories.d.ts +7 -0
  42. package/dist/stories/ColorLegends/ContinousLegends/SW.stories.js +27 -0
  43. package/dist/stories/ColorLegends/ContinousLegends/SW.stories.js.map +1 -0
  44. package/package.json +13 -11
  45. package/src/component/ColorSelector/ColorSelectorComponent.tsx +68 -0
  46. package/src/component/ColorSelector/ColorTableSelectorWrapper.tsx +51 -0
  47. package/src/component/ColorTableTypes.ts +1 -1
  48. package/src/component/Legend/ContinuousLegend.tsx +15 -9
  49. package/src/component/Legend/DiscreteLegend.tsx +18 -12
  50. package/src/component/Legend/legendContinous.tsx +175 -0
  51. package/src/component/Utils/d3ColorScale.ts +39 -0
  52. package/src/stories/ColorLegends/ColorSelector/Selector.stories.jsx +12 -0
  53. package/src/stories/ColorLegends/ContinousLegends/MD.stories.jsx +29 -0
  54. package/src/stories/ColorLegends/ContinousLegends/NTG.stories.jsx +29 -0
  55. package/src/stories/ColorLegends/ContinousLegends/PermTot.stories.jsx +29 -0
  56. package/src/stories/ColorLegends/ContinousLegends/Permeability.stories.jsx +29 -0
  57. package/src/stories/ColorLegends/ContinousLegends/PoroTot.stories.jsx +29 -0
  58. package/src/stories/ColorLegends/ContinousLegends/Porosity.stories.jsx +29 -0
  59. package/src/stories/ColorLegends/ContinousLegends/SW.stories.jsx +29 -0
  60. package/tsconfig.json +0 -2
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ interface legendProps {
3
+ useColorTableColors: boolean;
4
+ useD3Colors: boolean;
5
+ }
6
+ export declare const ColorSelector: React.FC<legendProps>;
7
+ export {};
@@ -0,0 +1,36 @@
1
+ import * as React from "react";
2
+ import { LegendContinous } from "../Legend/legendContinous";
3
+ import * as colorTables from "../color-tables.json";
4
+ import { colorScalesCont } from "../Utils/d3ColorScale";
5
+ const position = [16, 206];
6
+ const continuosColorData = [];
7
+ const continuosD3ColorData = [];
8
+ // code is for color table continuous data
9
+ var colorTableContinuousData = colorTables.filter((element) => {
10
+ return element.discrete == false;
11
+ });
12
+ colorTableContinuousData.forEach((element) => {
13
+ continuosColorData.push({ color: element.colors, name: element.name });
14
+ });
15
+ // code is for d3 continuous data
16
+ var d3continuousData = colorScalesCont.filter((element) => {
17
+ return element.discrete == false;
18
+ });
19
+ d3continuousData.forEach((element) => {
20
+ continuosD3ColorData.push({ color: element.colors, name: element.name });
21
+ });
22
+ export const ColorSelector = ({ useColorTableColors, useD3Colors, }) => {
23
+ let continuousLegend;
24
+ if (useColorTableColors) {
25
+ continuousLegend = continuosColorData.map((value, key) => {
26
+ return React.createElement(LegendContinous, { position: position + key, colorArray: value, legendColor: '', legendColorName: '', useContColorTable: true, valueIndex: key });
27
+ });
28
+ }
29
+ if (useD3Colors) {
30
+ continuousLegend = continuosD3ColorData.map((val, key) => {
31
+ return React.createElement(LegendContinous, { position: position + key, colorArray: {}, legendColor: val.color, legendColorName: val.name, useContColorTable: false, valueIndex: key + "0" });
32
+ });
33
+ }
34
+ return (React.createElement("div", null, continuousLegend));
35
+ };
36
+ //# sourceMappingURL=ColorSelectorComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColorSelectorComponent.js","sourceRoot":"","sources":["../../../src/component/ColorSelector/ColorSelectorComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,WAAW,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAA;AAErD,MAAM,QAAQ,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;AAC3B,MAAM,kBAAkB,GAAQ,EAAE,CAAA;AAClC,MAAM,oBAAoB,GAAQ,EAAE,CAAA;AAOpC,0CAA0C;AAC1C,IAAI,wBAAwB,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,OAAY,EAAE,EAAE;IAC/D,OAAO,OAAO,CAAC,QAAQ,IAAI,KAAK,CAAC;AACrC,CAAC,CAAC,CAAC;AAEH,wBAAwB,CAAC,OAAO,CAAC,CAAC,OAAY,EAAE,EAAE;IAC9C,kBAAkB,CAAC,IAAI,CAAC,EAAC,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAC,CAAC,CAAA;AACxE,CAAC,CAAC,CAAC;AAEH,iCAAiC;AACjC,IAAI,gBAAgB,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,OAAY,EAAE,EAAE;IAC3D,OAAO,OAAO,CAAC,QAAQ,IAAI,KAAK,CAAC;AACrC,CAAC,CAAC,CAAC;AAEH,gBAAgB,CAAC,OAAO,CAAC,CAAC,OAAY,EAAE,EAAE;IACtC,oBAAoB,CAAC,IAAI,CAAC,EAAC,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAC,CAAC,CAAA;AAC1E,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,aAAa,GAA0B,CAAC,EACjD,mBAAmB,EACnB,WAAW,GACD,EAAE,EAAE;IACd,IAAI,gBAAgB,CAAC;IACrB,IAAI,mBAAmB,EAAE;QACrB,gBAAgB,GAAI,kBAAkB,CAAC,GAAG,CAAC,CAAC,KAAU,EAAE,GAAQ,EAAE,EAAE;YAChE,OAAO,oBAAC,eAAe,IACX,QAAQ,EAAE,QAAQ,GAAG,GAAG,EACxB,UAAU,EAAE,KAAK,EACjB,WAAW,EAAE,EAAE,EACf,eAAe,EAAE,EAAE,EACnB,iBAAiB,EAAE,IAAI,EACvB,UAAU,EAAE,GAAG,GACzB,CAAA;QACN,CAAC,CAAC,CAAC;KACN;IACD,IAAI,WAAW,EAAE;QACb,gBAAgB,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAC,GAAQ,EAAE,GAAQ,EAAE,EAAE;YAC/D,OAAO,oBAAC,eAAe,IACX,QAAQ,EAAE,QAAQ,GAAG,GAAG,EACxB,UAAU,EAAE,EAAE,EACd,WAAW,EAAE,GAAG,CAAC,KAAK,EACtB,eAAe,EAAE,GAAG,CAAC,IAAI,EACzB,iBAAiB,EAAE,KAAK,EACxB,UAAU,EAAE,GAAG,GAAG,GAAG,GAC/B,CAAA;QACN,CAAC,CAAC,CAAC;KACN;IAED,OAAO,CACH,iCACK,gBAAgB,CACf,CACT,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const ColorSelectorWrapper: () => JSX.Element;
@@ -0,0 +1,27 @@
1
+ import * as React from "react";
2
+ import { Accordion } from "@equinor/eds-core-react";
3
+ import { ColorSelector } from "./ColorSelectorComponent";
4
+ export const ColorSelectorWrapper = () => {
5
+ // export const ColorSelector: React.FC<legendProps> = ({
6
+ // }: legendProps) => {
7
+ return (React.createElement("div", { style: { width: "450px" } },
8
+ React.createElement(Accordion, null,
9
+ React.createElement(Accordion.Item, null,
10
+ React.createElement(Accordion.Header, null, "Color Scales"),
11
+ React.createElement(Accordion.Panel, null,
12
+ React.createElement(Accordion, null,
13
+ React.createElement(Accordion.Item, null,
14
+ React.createElement(Accordion.Header, null, "Geologic Color Scale"),
15
+ React.createElement(Accordion.Panel, null,
16
+ React.createElement(ColorSelector, { useColorTableColors: true, useD3Colors: false, key: 1 })))),
17
+ React.createElement(Accordion, null,
18
+ React.createElement(Accordion.Item, null,
19
+ React.createElement(Accordion.Header, null, "D3 Color Scale"),
20
+ React.createElement(Accordion.Panel, null,
21
+ React.createElement(ColorSelector, { useColorTableColors: false, useD3Colors: true, key: 1 })))),
22
+ React.createElement(Accordion, null,
23
+ React.createElement(Accordion.Item, null,
24
+ React.createElement(Accordion.Header, null, "Custom Color Scale"),
25
+ React.createElement(Accordion.Panel, null, "Custom Content"))))))));
26
+ };
27
+ //# sourceMappingURL=ColorTableSelectorWrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColorTableSelectorWrapper.js","sourceRoot":"","sources":["../../../src/component/ColorSelector/ColorTableSelectorWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAG,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAEvD,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACrC,yDAAyD;IACzD,uBAAuB;IACvB,OAAO,CACH,6BAAK,KAAK,EAAE,EAAC,KAAK,EAAE,OAAO,EAAC;QACxB,oBAAC,SAAS;YACN,oBAAC,SAAS,CAAC,IAAI;gBACX,oBAAC,SAAS,CAAC,MAAM,uBAEE;gBACnB,oBAAC,SAAS,CAAC,KAAK;oBACZ,oBAAC,SAAS;wBACN,oBAAC,SAAS,CAAC,IAAI;4BACX,oBAAC,SAAS,CAAC,MAAM,+BAEE;4BACnB,oBAAC,SAAS,CAAC,KAAK;gCACZ,oBAAC,aAAa,IAAC,mBAAmB,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,GAAG,CACzD,CACL,CACT;oBACZ,oBAAC,SAAS;wBACN,oBAAC,SAAS,CAAC,IAAI;4BACX,oBAAC,SAAS,CAAC,MAAM,yBAEE;4BACnB,oBAAC,SAAS,CAAC,KAAK;gCACZ,oBAAC,aAAa,IAAC,mBAAmB,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,GAAG,CACzD,CACL,CACT;oBACZ,oBAAC,SAAS;wBACN,oBAAC,SAAS,CAAC,IAAI;4BACX,oBAAC,SAAS,CAAC,MAAM,6BAEE;4BACnB,oBAAC,SAAS,CAAC,KAAK,yBAEE,CACL,CACT,CACE,CACL,CACT,CACV,CACT,CAAC;AACN,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  export declare type colorTablesObj = {
2
2
  name: string;
3
- description: string;
3
+ discrete: boolean;
4
4
  colors: [number, number, number, number][];
5
5
  };
6
6
  export declare type colorTablesArray = Array<colorTablesObj>;
@@ -4,10 +4,10 @@ declare type legendProps = {
4
4
  min: number;
5
5
  max: number;
6
6
  dataObjectName: string;
7
- position: number[];
7
+ position?: number[] | null;
8
8
  colorName: string;
9
9
  colorTables: colorTablesArray;
10
- horizontal: boolean;
10
+ horizontal?: boolean | null;
11
11
  };
12
12
  export declare const ContinuousLegend: React.FC<legendProps>;
13
13
  export {};
@@ -1,11 +1,19 @@
1
1
  import * as React from "react";
2
+ import { useRef } from "react";
2
3
  import { RGBToHex, colorsArray } from "../Utils/continousLegend";
3
4
  import { select, scaleLinear, scaleSequential, axisBottom } from "d3";
4
5
  export const ContinuousLegend = ({ min, max, dataObjectName, position, colorName, colorTables, horizontal, }) => {
6
+ const divRef = useRef(null);
5
7
  React.useEffect(() => {
6
- continuousLegend("#legend");
8
+ if (divRef.current) {
9
+ continuousLegend();
10
+ }
11
+ ;
12
+ return function cleanup() {
13
+ select(divRef.current).select("svg").remove();
14
+ };
7
15
  }, [min, max, colorName, colorTables, horizontal]);
8
- function continuousLegend(selected_id) {
16
+ function continuousLegend() {
9
17
  const itemColor = [];
10
18
  // Return the matched colors array from color.tables.json file
11
19
  const colorTableColors = colorsArray(colorName, colorTables);
@@ -16,10 +24,9 @@ export const ContinuousLegend = ({ min, max, dataObjectName, position, colorName
16
24
  color: RGBToHex(value).color,
17
25
  });
18
26
  });
19
- select(selected_id).select("svg").remove();
20
27
  const colorScale = scaleSequential().domain([min, max]);
21
28
  // append a defs (for definition) element to your SVG
22
- const svgLegend = select(selected_id)
29
+ const svgLegend = select(divRef.current)
23
30
  .append("svg")
24
31
  .style("background-color", "#ffffffcc")
25
32
  .style("border-radius", "5px");
@@ -78,10 +85,10 @@ export const ContinuousLegend = ({ min, max, dataObjectName, position, colorName
78
85
  }
79
86
  return (React.createElement("div", { style: {
80
87
  position: "absolute",
81
- right: position[0],
82
- top: position[1],
88
+ right: position ? position[0] : ' ',
89
+ top: position ? position[1] : ' ',
83
90
  } },
84
- React.createElement("div", { id: "legend" })));
91
+ React.createElement("div", { id: "legend", ref: divRef })));
85
92
  };
86
93
  ContinuousLegend.defaultProps = {
87
94
  position: [5, 10],
@@ -1 +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;AAkBtE,MAAM,CAAC,MAAM,gBAAgB,GAA0B,CAAC,EACpD,GAAG,EACH,GAAG,EACH,cAAc,EACd,QAAQ,EAC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,EAAE,CAAC;aAClB,KAAK,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;QAE5C,mBAAmB;QACnB,MAAM,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,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;YACnC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;SACpC;QAED,6BAAK,EAAE,EAAC,QAAQ,EAAC,GAAG,EAAE,MAAM,GAAQ,CAClC,CACT,CAAC;AACN,CAAC,CAAC;AAEF,gBAAgB,CAAC,YAAY,GAAG;IAC5B,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;CACpB,CAAC"}
@@ -5,10 +5,10 @@ declare type colorLegendProps = {
5
5
  objects: Record<string, [number[], number]>;
6
6
  };
7
7
  dataObjectName: string;
8
- position: number[];
8
+ position?: number[] | null;
9
9
  colorName: string;
10
10
  colorTables: colorTablesArray;
11
- horizontal: boolean;
11
+ horizontal?: boolean | null;
12
12
  };
13
13
  export declare const DiscreteColorLegend: React.FC<colorLegendProps>;
14
14
  export declare function colorTableData(colorName: string, colorTables: colorTablesArray): [number, number, number, number][];
@@ -1,11 +1,19 @@
1
1
  import * as React from "react";
2
+ import { useRef } from "react";
2
3
  import legendUtil from "../Utils/discreteLegend";
3
4
  import { scaleOrdinal, select } from "d3";
4
5
  export const DiscreteColorLegend = ({ discreteData, dataObjectName, position, colorName, colorTables, horizontal, }) => {
6
+ const divRef = useRef(null);
5
7
  React.useEffect(() => {
6
- discreteLegend("#legend");
8
+ if (divRef.current) {
9
+ discreteLegend();
10
+ }
11
+ return function cleanup() {
12
+ select(divRef.current).select("div").remove();
13
+ select(divRef.current).select("svg").remove();
14
+ };
7
15
  }, [discreteData, colorName, colorTables, horizontal]);
8
- function discreteLegend(legend) {
16
+ function discreteLegend() {
9
17
  const itemName = [];
10
18
  const itemColor = [];
11
19
  const colorsArray = colorTableData(colorName, colorTables);
@@ -34,24 +42,22 @@ export const DiscreteColorLegend = ({ discreteData, dataObjectName, position, co
34
42
  }
35
43
  const ordinalValues = scaleOrdinal().domain(itemName);
36
44
  const colorLegend = legendUtil(itemColor).inputScale(ordinalValues);
37
- select(legend).select("div").remove();
38
- select(legend).select("svg").remove();
39
45
  const legendLength = itemColor.length;
40
46
  const calcLegendHeight = 22 * legendLength + 4 * legendLength;
41
- const selectedLegend = select(legend);
47
+ const selectedLegend = select(divRef.current);
42
48
  selectedLegend
43
49
  .append("div")
44
50
  .text(dataObjectName)
45
51
  .attr("y", 7)
46
52
  .style("color", "#6F6F6F")
47
53
  .style("margin", "10px 10px");
48
- if (!horizontal)
54
+ if (horizontal)
49
55
  selectedLegend.style("height", 150 + "px");
50
56
  const svgLegend = selectedLegend
51
57
  .append("svg")
52
58
  .style("margin", "10px 10px")
53
59
  .call(colorLegend);
54
- if (colorLegend && horizontal) {
60
+ if (colorLegend && !horizontal) {
55
61
  svgLegend
56
62
  .attr("height", calcLegendHeight + "px")
57
63
  .attr("width", 220 + "px");
@@ -65,12 +71,12 @@ export const DiscreteColorLegend = ({ discreteData, dataObjectName, position, co
65
71
  }
66
72
  return (React.createElement("div", { style: {
67
73
  position: "absolute",
68
- right: position[0],
69
- top: position[1],
74
+ right: position ? position[0] : ' ',
75
+ top: position ? position[1] : ' ',
70
76
  backgroundColor: "#ffffffcc",
71
77
  borderRadius: "5px",
72
78
  } },
73
- React.createElement("div", { id: "legend" })));
79
+ React.createElement("div", { id: "legend", ref: divRef })));
74
80
  };
75
81
  // Based on name return the colors array from color.tables.json file
76
82
  export function colorTableData(colorName, colorTables) {
@@ -1 +1 @@
1
- {"version":3,"file":"DiscreteLegend.js","sourceRoot":"","sources":["../../../src/component/Legend/DiscreteLegend.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,UAAU,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAgB1C,MAAM,CAAC,MAAM,mBAAmB,GAA+B,CAAC,EAC5D,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,SAAS,EACT,WAAW,EACX,UAAU,GACK,EAAE,EAAE;IACnB,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,cAAc,CAAC,SAAS,CAAC,CAAC;IAC9B,CAAC,EAAE,CAAC,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC;IACvD,SAAS,cAAc,CAAC,MAAc;QAClC,MAAM,QAAQ,GAAa,EAAE,CAAC;QAC9B,MAAM,SAAS,GAAgB,EAAE,CAAC;QAClC,MAAM,WAAW,GAAuC,cAAc,CAClE,SAAS,EACT,WAAW,CACd,CAAC;QACF,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACtC,2BAA2B;YAC3B,IAAI,IAAI,GAAI,YAAuC,CAAC,GAAG,CAAC,CAAC,CA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AI,CAAC,CAAC;SAClC;aAAM;YACH,SAAS;iBACJ,KAAK,CAAC,WAAW,EAAE,eAAe,CAAC;iBACnC,IAAI,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAAC;iBACtC,IAAI,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAC,CAAC;SAChD;IACL,CAAC;IACD,OAAO,CACH,6BACI,KAAK,EAAE;YACH,QAAQ,EAAE,UAAU;YACpB,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;YACnC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;YACjC,eAAe,EAAE,WAAW;YAC5B,YAAY,EAAE,KAAK;SACtB;QAED,6BAAK,EAAE,EAAC,QAAQ,EAAC,GAAG,EAAE,MAAM,GAAQ,CAClC,CACT,CAAC;AACN,CAAC,CAAC;AAEF,oEAAoE;AACpE,MAAM,UAAU,cAAc,CAC1B,SAAiB,EACjB,WAA6B;IAE7B,MAAM,cAAc,GAAG,WAAW,CAAC,MAAM,CACrC,CAAC,KAAqB,EAAE,EAAE,CACtB,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,SAAS,CAAC,WAAW,EAAE,CAC1D,CAAC;IACF,OAAO,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;AACrE,CAAC;AAED,mBAAmB,CAAC,YAAY,GAAG;IAC/B,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;CACpB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import * as React from "react";
2
+ interface legendProps {
3
+ position?: number[] | null;
4
+ colorArray: any;
5
+ legendColor: any;
6
+ legendColorName: string;
7
+ useContColorTable: boolean;
8
+ valueIndex: any;
9
+ }
10
+ export declare const LegendContinous: React.FC<legendProps>;
11
+ export {};
@@ -0,0 +1,132 @@
1
+ import * as React from "react";
2
+ import { useRef } from "react";
3
+ import { RGBToHex } from "../Utils/continousLegend";
4
+ import { colorScalesCont } from "../Utils/d3ColorScale";
5
+ import * as d3 from "d3";
6
+ export const LegendContinous = ({ position, colorArray, legendColor, legendColorName, useContColorTable, valueIndex, }) => {
7
+ const divRef = useRef(null);
8
+ React.useEffect(() => {
9
+ // colortable colors
10
+ if (useContColorTable == true && divRef.current) {
11
+ colortableLegend();
12
+ }
13
+ // d3 colors
14
+ else if (useContColorTable == false && divRef.current) {
15
+ d3colorLegend(colorScalesCont);
16
+ }
17
+ return function cleanup() {
18
+ d3.select(divRef.current).select("svg").remove();
19
+ };
20
+ }, [useContColorTable]);
21
+ function colortableLegend() {
22
+ const itemColor = [];
23
+ colorArray.color.forEach((value) => {
24
+ // return the color and offset needed to draw the legend
25
+ itemColor.push({
26
+ offset: RGBToHex(value).offset,
27
+ color: RGBToHex(value).color,
28
+ });
29
+ });
30
+ // append a defs (for definition) element to your SVG
31
+ const svgLegend = d3.select(divRef.current)
32
+ .append("svg")
33
+ .style("height", "50px")
34
+ .style("display", "flex");
35
+ const defs = svgLegend.append("defs");
36
+ let currentIndex = "linear-gradient-" + valueIndex;
37
+ // append a linearGradient element to the defs and give it a unique id
38
+ const linearGradient = defs
39
+ .append("linearGradient")
40
+ .attr("id", currentIndex)
41
+ .attr("x1", "0%")
42
+ .attr("x2", "100%") //since it's a horizontal linear gradient
43
+ .attr("y1", "0%")
44
+ .attr("y2", "0%");
45
+ // append multiple color stops by using D3's data/enter step
46
+ linearGradient
47
+ .selectAll("stop")
48
+ .data(itemColor)
49
+ .enter()
50
+ .append("stop")
51
+ .attr("offset", function (data) {
52
+ return data.offset + "%";
53
+ })
54
+ .attr("stop-color", function (data) {
55
+ return data.color;
56
+ });
57
+ // append title
58
+ svgLegend
59
+ .append("text")
60
+ .attr("class", "legendTitle")
61
+ .attr("x", 0)
62
+ .attr("y", 43)
63
+ .style("text-anchor", "left")
64
+ .text(colorArray.name);
65
+ // draw the rectangle and fill with gradient
66
+ svgLegend
67
+ .append("rect")
68
+ .attr("x", 180)
69
+ .attr("y", 30)
70
+ .attr("width", 150)
71
+ .attr("height", 25)
72
+ .style("fill", "url(#" + currentIndex + ")");
73
+ }
74
+ // continuous legend using d3 color scale (linear gradiend code)
75
+ function d3colorLegend(colorscale) {
76
+ const itemColor = [];
77
+ colorscale.forEach((value) => {
78
+ // return the color and offset needed to draw the legend
79
+ itemColor.push(value.colors);
80
+ });
81
+ // create an array of steps based on the color scale
82
+ // returns an array of evenly-spaced numbers. Returns the integers from zero to the specified end minus one.
83
+ // d3.range(start, stop, step)
84
+ var data = d3.range(10).map(d => ({ color: legendColor(d / 10), value: d }));
85
+ // get the array's min and max value
86
+ var extent = d3.extent(data, d => d.value);
87
+ // append a defs (for definition) element to your SVG
88
+ const svgLegend = d3.select(divRef.current)
89
+ .append("svg")
90
+ .style("height", "50px")
91
+ .style("display", "flex");
92
+ const defs = svgLegend.append("defs");
93
+ let currentIndex = "linear-gradient-" + valueIndex;
94
+ // append a linearGradient element to the defs and give it a unique id
95
+ const linearGradient = defs
96
+ .append("linearGradient")
97
+ .attr("id", currentIndex)
98
+ .attr("x1", "0%")
99
+ .attr("x2", "100%") //since it's a horizontal linear gradient
100
+ .attr("y1", "0%")
101
+ .attr("y2", "0%");
102
+ // append multiple color stops by using D3's data/enter step
103
+ linearGradient.selectAll("stop")
104
+ .data(data)
105
+ .enter().append("stop")
106
+ .attr("offset", d => ((d.value - extent[0]) / (extent[1] - extent[0]) * 100) + "%")
107
+ .attr("stop-color", d => d.color);
108
+ // append title
109
+ svgLegend
110
+ .append("text")
111
+ .attr("class", "legendTitle")
112
+ .attr("x", 0)
113
+ .attr("y", 43)
114
+ .style("text-anchor", "left")
115
+ .text(legendColorName);
116
+ // draw the rectangle and fill with gradient
117
+ svgLegend
118
+ .append("rect")
119
+ .attr("x", 180)
120
+ .attr("y", 30)
121
+ .attr("width", 150)
122
+ .attr("height", 25)
123
+ .style("fill", "url(#" + currentIndex + ")");
124
+ }
125
+ return (React.createElement("div", { style: {
126
+ right: position ? position[0] : ' ',
127
+ top: position ? position[1] : ' ',
128
+ } }, useContColorTable ? React.createElement("div", { className: "colortableLegend", ref: divRef })
129
+ :
130
+ React.createElement("div", { className: "d3colorLegend", ref: divRef })));
131
+ };
132
+ //# sourceMappingURL=legendContinous.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legendContinous.js","sourceRoot":"","sources":["../../../src/component/Legend/legendContinous.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAA;AACrD,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAgBzB,MAAM,CAAC,MAAM,eAAe,GAA0B,CAAC,EACnD,QAAQ,EACR,UAAU,EACV,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,UAAU,GACA,EAAE,EAAE;IACd,MAAM,MAAM,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC5C,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,oBAAoB;QACpB,IAAI,iBAAiB,IAAI,IAAI,IAAI,MAAM,CAAC,OAAO,EAAE;YAC7C,gBAAgB,EAAE,CAAA;SACrB;QACD,YAAY;aACP,IAAI,iBAAiB,IAAI,KAAK,IAAI,MAAM,CAAC,OAAO,EAAE;YACnD,aAAa,CAAC,eAAe,CAAC,CAAA;SACjC;QACD,OAAO,SAAS,OAAO;YACnB,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC;QACrD,CAAC,CAAC;I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d,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC;aAC5B,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;aACZ,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;aACb,KAAK,CAAC,aAAa,EAAE,MAAM,CAAC;aAC5B,IAAI,CAAC,eAAe,CAAC,CAAC;QAE3B,4CAA4C;QAC5C,SAAS;aACJ,MAAM,CAAC,MAAM,CAAC;aACd,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC;aACd,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;aACb,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC;aAClB,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC;aAClB,KAAK,CAAC,MAAM,EAAE,OAAO,GAAC,YAAY,GAAC,GAAG,CAAC,CAAC;IACjD,CAAC;IAED,OAAO,CACH,6BACI,KAAK,EAAE;YACH,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;YACnC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;SACpC,IAEA,iBAAiB,CAAC,CAAC,CAAC,6BAAK,SAAS,EAAC,kBAAkB,EAAC,GAAG,EAAE,MAAM,GAAQ;QAC1E,CAAC;YACD,6BAAK,SAAS,EAAC,eAAe,EAAC,GAAG,EAAE,MAAM,GAAQ,CAChD,CACT,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import * as d3 from "d3";
2
+ export declare const colorScalesCont: {
3
+ name: string;
4
+ discrete: boolean;
5
+ colors: typeof d3.interpolateSpectral;
6
+ }[];
7
+ export declare function interpolatorContinuous(): d3.ScaleSequential<string, never>;
@@ -0,0 +1,38 @@
1
+ import * as d3 from "d3";
2
+ export const colorScalesCont = [
3
+ {
4
+ "name": "Spectral",
5
+ "discrete": false,
6
+ "colors": d3.interpolateSpectral
7
+ },
8
+ {
9
+ "name": "RdYlBu",
10
+ "discrete": false,
11
+ "colors": d3.interpolateRdYlBu
12
+ },
13
+ {
14
+ "name": "Warm",
15
+ "discrete": false,
16
+ "colors": d3.interpolateWarm
17
+ },
18
+ {
19
+ "name": "Cool",
20
+ "discrete": false,
21
+ "colors": d3.interpolateCool
22
+ },
23
+ {
24
+ "name": "Viridis",
25
+ "discrete": false,
26
+ "colors": d3.interpolateViridis
27
+ },
28
+ {
29
+ "name": "Inferno",
30
+ "discrete": false,
31
+ "colors": d3.interpolateInferno
32
+ },
33
+ ];
34
+ export function interpolatorContinuous() {
35
+ return d3.scaleSequential(d3.interpolateInferno);
36
+ }
37
+ ;
38
+ //# sourceMappingURL=d3ColorScale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"d3ColorScale.js","sourceRoot":"","sources":["../../../src/component/Utils/d3ColorScale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B;QACE,MAAM,EAAE,UAAU;QAClB,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,EAAE,CAAC,mBAAmB;KACjC;IACD;QACE,MAAM,EAAE,QAAQ;QAChB,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,EAAE,CAAC,iBAAiB;KAC/B;IACD;QACE,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,EAAE,CAAC,eAAe;KAC7B;IACD;QACE,MAAM,EAAE,MAAM;QACd,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,EAAE,CAAC,eAAe;KAC7B;IACD;QACE,MAAM,EAAE,SAAS;QACjB,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,EAAE,CAAC,kBAAkB;KAChC;IACD;QACE,MAAM,EAAE,SAAS;QACjB,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,EAAE,CAAC,kBAAkB;KAChC;CACF,CAAA;AAGD,MAAM,UAAU,sBAAsB;IACpC,OAAO,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC;AACnD,CAAC;AAAA,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"}
@@ -0,0 +1,7 @@
1
+ declare namespace _default {
2
+ export { ContinuousLegend as component };
3
+ export const title: string;
4
+ }
5
+ export default _default;
6
+ export const MDTemplate: any;
7
+ import { ContinuousLegend } from "../../../component/Legend/ContinuousLegend";
@@ -0,0 +1,27 @@
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 colorTables from "../../../component/color-tables.json";
8
+ const min = 2918;
9
+ const max = 4770;
10
+ const dataObjectName = "Wells / MD";
11
+ const position = [16, 10];
12
+ const horizontal = true;
13
+ const colorName = "Time/Depth";
14
+ const Template = (args) => {
15
+ return React.createElement(ContinuousLegend, Object.assign({}, args));
16
+ };
17
+ export const MDTemplate = Template.bind({});
18
+ MDTemplate.args = {
19
+ min,
20
+ max,
21
+ dataObjectName,
22
+ position,
23
+ colorName,
24
+ colorTables,
25
+ horizontal,
26
+ };
27
+ //# sourceMappingURL=MD.stories.js.map
@@ -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"}
@@ -0,0 +1,7 @@
1
+ declare namespace _default {
2
+ export { ContinuousLegend as component };
3
+ export const title: string;
4
+ }
5
+ export default _default;
6
+ export const NTGTemplate: any;
7
+ import { ContinuousLegend } from "../../../component/Legend/ContinuousLegend";
@@ -0,0 +1,27 @@
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 colorTables from "../../../component/color-tables.json";
8
+ const min = 0;
9
+ const max = 1;
10
+ const dataObjectName = "Wells / NTG";
11
+ const position = [16, 10];
12
+ const horizontal = true;
13
+ const colorName = "Rainbow";
14
+ const Template = (args) => {
15
+ return React.createElement(ContinuousLegend, Object.assign({}, args));
16
+ };
17
+ export const NTGTemplate = Template.bind({});
18
+ NTGTemplate.args = {
19
+ min,
20
+ max,
21
+ dataObjectName,
22
+ position,
23
+ colorName,
24
+ colorTables,
25
+ horizontal,
26
+ };
27
+ //# sourceMappingURL=NTG.stories.js.map
@@ -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"}
@@ -0,0 +1,7 @@
1
+ declare namespace _default {
2
+ export { ContinuousLegend as component };
3
+ export const title: string;
4
+ }
5
+ export default _default;
6
+ export const PermTotTemplate: any;
7
+ import { ContinuousLegend } from "../../../component/Legend/ContinuousLegend";
@@ -0,0 +1,27 @@
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 colorTables from "../../../component/color-tables.json";
8
+ const min = -999;
9
+ const max = 14023;
10
+ const dataObjectName = "Wells / PERMTOT";
11
+ const position = [16, 10];
12
+ const horizontal = true;
13
+ const colorName = "Porosity";
14
+ const Template = (args) => {
15
+ return React.createElement(ContinuousLegend, Object.assign({}, args));
16
+ };
17
+ export const PermTotTemplate = Template.bind({});
18
+ PermTotTemplate.args = {
19
+ min,
20
+ max,
21
+ dataObjectName,
22
+ position,
23
+ colorName,
24
+ colorTables,
25
+ horizontal,
26
+ };
27
+ //# sourceMappingURL=PermTot.stories.js.map