@emerson-eps/color-tables 0.1.22 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/component/ColorSelector/ColorSelectorComponent.d.ts +7 -0
- package/dist/component/ColorSelector/ColorSelectorComponent.js +62 -0
- package/dist/component/ColorSelector/ColorSelectorComponent.js.map +1 -0
- package/dist/component/ColorSelector/ColorTableSelectorWrapper.d.ts +2 -0
- package/dist/component/ColorSelector/ColorTableSelectorWrapper.js +25 -0
- package/dist/component/ColorSelector/ColorTableSelectorWrapper.js.map +1 -0
- package/dist/component/ColorSelector/legendComponent.d.ts +14 -0
- package/dist/component/ColorSelector/legendComponent.js +228 -0
- package/dist/component/ColorSelector/legendComponent.js.map +1 -0
- package/dist/component/Legend/ContinuousLegend.d.ts +1 -1
- package/dist/component/Legend/ContinuousLegend.js +84 -65
- package/dist/component/Legend/ContinuousLegend.js.map +1 -1
- package/dist/component/Legend/DiscreteLegend.d.ts +1 -1
- package/dist/component/Legend/DiscreteLegend.js +71 -52
- package/dist/component/Legend/DiscreteLegend.js.map +1 -1
- package/dist/component/Utils/d3ColorScale.d.ts +10 -0
- package/dist/component/Utils/d3ColorScale.js +84 -0
- package/dist/component/Utils/d3ColorScale.js.map +1 -0
- package/dist/component/Utils/discreteLegend.d.ts +2 -2
- package/dist/component/Utils/discreteLegend.js +26 -15
- package/dist/component/Utils/discreteLegend.js.map +1 -1
- package/dist/stories/ColorLegends/ColorSelector/Selector.stories.d.ts +7 -0
- package/dist/stories/ColorLegends/ColorSelector/Selector.stories.js +11 -0
- package/dist/stories/ColorLegends/ColorSelector/Selector.stories.js.map +1 -0
- package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/MD.stories.d.ts +0 -0
- package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/MD.stories.js +0 -2
- package/dist/stories/ColorLegends/ContinousLegends/MD.stories.js.map +1 -0
- package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/NTG.stories.d.ts +0 -0
- package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/NTG.stories.js +0 -2
- package/dist/stories/ColorLegends/ContinousLegends/NTG.stories.js.map +1 -0
- package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/PermTot.stories.d.ts +0 -0
- package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/PermTot.stories.js +0 -2
- package/dist/stories/ColorLegends/ContinousLegends/PermTot.stories.js.map +1 -0
- package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/Permeability.stories.d.ts +0 -0
- package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/Permeability.stories.js +0 -2
- package/dist/stories/ColorLegends/ContinousLegends/Permeability.stories.js.map +1 -0
- package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/PoroTot.stories.d.ts +0 -0
- package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/PoroTot.stories.js +0 -2
- package/dist/stories/ColorLegends/ContinousLegends/PoroTot.stories.js.map +1 -0
- package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/Porosity.stories.d.ts +0 -0
- package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/Porosity.stories.js +0 -2
- package/dist/stories/ColorLegends/ContinousLegends/Porosity.stories.js.map +1 -0
- package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/SW.stories.d.ts +0 -0
- package/dist/stories/ColorLegends/{ContinousLgends → ContinousLegends}/SW.stories.js +2 -4
- package/dist/stories/ColorLegends/ContinousLegends/SW.stories.js.map +1 -0
- package/package.json +3 -1
- package/src/component/ColorSelector/ColorSelectorComponent.tsx +109 -0
- package/src/component/ColorSelector/ColorTableSelectorWrapper.tsx +49 -0
- package/src/component/ColorSelector/legendComponent.tsx +289 -0
- package/src/component/Legend/ContinuousLegend.tsx +12 -3
- package/src/component/Legend/DiscreteLegend.tsx +14 -6
- package/src/component/Utils/d3ColorScale.ts +84 -0
- package/src/component/Utils/discreteLegend.ts +34 -23
- package/src/stories/ColorLegends/ColorSelector/Selector.stories.jsx +12 -0
- package/src/stories/ColorLegends/{ContinousLgends → ContinousLegends}/MD.stories.jsx +0 -2
- package/src/stories/ColorLegends/{ContinousLgends → ContinousLegends}/NTG.stories.jsx +0 -2
- package/src/stories/ColorLegends/{ContinousLgends → ContinousLegends}/PermTot.stories.jsx +0 -2
- package/src/stories/ColorLegends/{ContinousLgends → ContinousLegends}/Permeability.stories.jsx +0 -2
- package/src/stories/ColorLegends/{ContinousLgends → ContinousLegends}/PoroTot.stories.jsx +0 -2
- package/src/stories/ColorLegends/{ContinousLgends → ContinousLegends}/Porosity.stories.jsx +0 -2
- package/src/stories/ColorLegends/{ContinousLgends → ContinousLegends}/SW.stories.jsx +2 -4
- package/tsconfig.json +1 -1
- package/dist/stories/ColorLegends/ContinousLgends/MD.stories.js.map +0 -1
- package/dist/stories/ColorLegends/ContinousLgends/NTG.stories.js.map +0 -1
- package/dist/stories/ColorLegends/ContinousLgends/PermTot.stories.js.map +0 -1
- package/dist/stories/ColorLegends/ContinousLgends/Permeability.stories.js.map +0 -1
- package/dist/stories/ColorLegends/ContinousLgends/PoroTot.stories.js.map +0 -1
- package/dist/stories/ColorLegends/ContinousLgends/Porosity.stories.js.map +0 -1
- package/dist/stories/ColorLegends/ContinousLgends/SW.stories.js.map +0 -1
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
const position = [16, 206];
|
|
6
|
+
const continuosColorData = [];
|
|
7
|
+
const continuosD3ColorData = [];
|
|
8
|
+
const discreteColorData = [];
|
|
9
|
+
const discreteD3ColorData = [];
|
|
10
|
+
// code is for color table continuous data
|
|
11
|
+
var colorTableContinuousData = colorTables.filter((element) => {
|
|
12
|
+
return element.discrete == false;
|
|
13
|
+
});
|
|
14
|
+
colorTableContinuousData.forEach((element) => {
|
|
15
|
+
continuosColorData.push({ color: element.colors, name: element.name });
|
|
16
|
+
});
|
|
17
|
+
// code is for d3 continuous data
|
|
18
|
+
var d3continuousData = d3ColorScales.filter((element) => {
|
|
19
|
+
return element.discrete == false;
|
|
20
|
+
});
|
|
21
|
+
d3continuousData.forEach((element) => {
|
|
22
|
+
continuosD3ColorData.push({ color: element.colors, name: element.name });
|
|
23
|
+
});
|
|
24
|
+
// code is for color table discrete data
|
|
25
|
+
var discreteData = colorTables.filter((element) => {
|
|
26
|
+
return element.discrete == true;
|
|
27
|
+
});
|
|
28
|
+
discreteData.forEach((element) => {
|
|
29
|
+
discreteColorData.push({ color: element.colors, name: element.name });
|
|
30
|
+
});
|
|
31
|
+
// code is for color table d3 discrete data
|
|
32
|
+
var d3discreteData = d3ColorScales.filter((element) => {
|
|
33
|
+
return element.discrete == true;
|
|
34
|
+
});
|
|
35
|
+
d3discreteData.forEach((element) => {
|
|
36
|
+
discreteD3ColorData.push({ color: element.colors, name: element.name });
|
|
37
|
+
});
|
|
38
|
+
export const ColorSelector = ({ useColorTableColors, useD3Colors, }) => {
|
|
39
|
+
let continuousLegend;
|
|
40
|
+
let discreteLegend;
|
|
41
|
+
if (useColorTableColors) {
|
|
42
|
+
continuousLegend = continuosColorData.map((value, key) => {
|
|
43
|
+
return React.createElement("div", null,
|
|
44
|
+
React.createElement(LegendComponent, { position: position + key, colorsObject: value, legendColor: '', legendColorName: '', useContColorTable: true, valueIndex: key }));
|
|
45
|
+
});
|
|
46
|
+
discreteLegend = discreteColorData.map((val, key) => {
|
|
47
|
+
return React.createElement(LegendComponent, { legendColorName: val.name, position: position, colorsObject: discreteColorData[key], useDiscColorTable: true });
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (useD3Colors) {
|
|
51
|
+
continuousLegend = continuosD3ColorData.map((val, key) => {
|
|
52
|
+
return React.createElement(LegendComponent, { position: position + key, colorsObject: {}, legendColor: val.color, legendColorName: val.name, useContColorTable: false, valueIndex: key + "0" });
|
|
53
|
+
});
|
|
54
|
+
discreteLegend = d3discreteData.map((val) => {
|
|
55
|
+
return React.createElement(LegendComponent, { legendColorName: val.name, position: position, colorsObject: val.colors, useDiscColorTable: false });
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return (React.createElement("div", null,
|
|
59
|
+
continuousLegend,
|
|
60
|
+
discreteLegend));
|
|
61
|
+
};
|
|
62
|
+
//# 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,KAAK,WAAW,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAElD,MAAM,QAAQ,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;AAC3B,MAAM,kBAAkB,GAAQ,EAAE,CAAA;AAClC,MAAM,oBAAoB,GAAQ,EAAE,CAAA;AACpC,MAAM,iBAAiB,GAAQ,EAAE,CAAA;AACjC,MAAM,mBAAmB,GAAQ,EAAE,CAAA;AAOnC,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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AC5C,CAAC,CAAC,CAAC;KACN;IAED,OAAO,CACH;QACK,gBAAgB;QAChB,cAAc,CACb,CACT,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Accordion } from "@equinor/eds-core-react";
|
|
3
|
+
import { ColorSelector } from "./ColorSelectorComponent";
|
|
4
|
+
export const ColorSelectorWrapper = () => {
|
|
5
|
+
return (React.createElement("div", { style: { width: "650px" } },
|
|
6
|
+
React.createElement(Accordion, null,
|
|
7
|
+
React.createElement(Accordion.Item, null,
|
|
8
|
+
React.createElement(Accordion.Header, null, "Color Scales"),
|
|
9
|
+
React.createElement(Accordion.Panel, null,
|
|
10
|
+
React.createElement(Accordion, null,
|
|
11
|
+
React.createElement(Accordion.Item, null,
|
|
12
|
+
React.createElement(Accordion.Header, null, "Geologic Color Scale"),
|
|
13
|
+
React.createElement(Accordion.Panel, null,
|
|
14
|
+
React.createElement(ColorSelector, { useColorTableColors: true, useD3Colors: false })))),
|
|
15
|
+
React.createElement(Accordion, null,
|
|
16
|
+
React.createElement(Accordion.Item, null,
|
|
17
|
+
React.createElement(Accordion.Header, null, "D3 Color Scale"),
|
|
18
|
+
React.createElement(Accordion.Panel, null,
|
|
19
|
+
React.createElement(ColorSelector, { useColorTableColors: false, useD3Colors: true })))),
|
|
20
|
+
React.createElement(Accordion, null,
|
|
21
|
+
React.createElement(Accordion.Item, null,
|
|
22
|
+
React.createElement(Accordion.Header, null, "Custom Color Scale"),
|
|
23
|
+
React.createElement(Accordion.Panel, null, "Custom Content"))))))));
|
|
24
|
+
};
|
|
25
|
+
//# 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,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACrC,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,GAAG,CACjD,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,GAAG,CACjD,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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { colorTablesArray } from "../ColorTableTypes";
|
|
3
|
+
interface legendProps {
|
|
4
|
+
position: number[];
|
|
5
|
+
colorsObject?: any;
|
|
6
|
+
legendColor?: any;
|
|
7
|
+
legendColorName: string;
|
|
8
|
+
useContColorTable?: boolean;
|
|
9
|
+
useDiscColorTable?: boolean;
|
|
10
|
+
valueIndex?: any;
|
|
11
|
+
}
|
|
12
|
+
export declare const LegendComponent: React.FC<legendProps>;
|
|
13
|
+
export declare function colorTableData(colorName: string, colorTables: colorTablesArray): [number, number, number, number][];
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useRef } from "react";
|
|
3
|
+
import { RGBToHex } from "../Utils/continousLegend";
|
|
4
|
+
import { d3ColorScales } from "../Utils/d3ColorScale";
|
|
5
|
+
import * as d3 from "d3";
|
|
6
|
+
import { scaleOrdinal, select } from "d3";
|
|
7
|
+
import discreteLegendUtil from "../Utils/discreteLegend";
|
|
8
|
+
export const LegendComponent = ({ position, colorsObject, legendColor, legendColorName, useContColorTable, useDiscColorTable, valueIndex, }) => {
|
|
9
|
+
const divRef = useRef(null);
|
|
10
|
+
React.useEffect(() => {
|
|
11
|
+
// continuous legend using color table colors
|
|
12
|
+
if (useContColorTable == true && divRef.current) {
|
|
13
|
+
contColortableLegend();
|
|
14
|
+
return function cleanup() {
|
|
15
|
+
d3.select(divRef.current).select("svg").remove();
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
// discrete legend using color table colors
|
|
19
|
+
if (useDiscColorTable == true && divRef.current) {
|
|
20
|
+
discColorTableLegend();
|
|
21
|
+
return function cleanup() {
|
|
22
|
+
select(divRef.current).select("div").remove();
|
|
23
|
+
select(divRef.current).select("svg").remove();
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
// discrete legend using d3 colors
|
|
27
|
+
if (useDiscColorTable == false && divRef.current) {
|
|
28
|
+
discD3legend();
|
|
29
|
+
return function cleanup() {
|
|
30
|
+
select(divRef.current).select("div").remove();
|
|
31
|
+
select(divRef.current).select("svg").remove();
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
// continuous legend using d3 colors
|
|
35
|
+
else if (useContColorTable == false && divRef.current) {
|
|
36
|
+
contD3Legend();
|
|
37
|
+
return function cleanup() {
|
|
38
|
+
d3.select(divRef.current).select("svg").remove();
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}, [useContColorTable]);
|
|
42
|
+
// continuous legend using color table colors (linear gradiend code)
|
|
43
|
+
function contColortableLegend() {
|
|
44
|
+
const itemColor = [];
|
|
45
|
+
colorsObject.color.forEach((value) => {
|
|
46
|
+
// return the color and offset needed to draw the legend
|
|
47
|
+
itemColor.push({
|
|
48
|
+
offset: RGBToHex(value).offset,
|
|
49
|
+
color: RGBToHex(value).color,
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
// append a defs (for definition) element to your SVG
|
|
53
|
+
const svgLegend = d3.select(divRef.current)
|
|
54
|
+
.append("svg")
|
|
55
|
+
.style("height", "50px")
|
|
56
|
+
.style("display", "flex");
|
|
57
|
+
const defs = svgLegend.append("defs");
|
|
58
|
+
let currentIndex = "linear-gradient-" + valueIndex;
|
|
59
|
+
// append a linearGradient element to the defs and give it a unique id
|
|
60
|
+
const linearGradient = defs
|
|
61
|
+
.append("linearGradient")
|
|
62
|
+
.attr("id", currentIndex)
|
|
63
|
+
.attr("x1", "0%")
|
|
64
|
+
.attr("x2", "100%") //since it's a horizontal linear gradient
|
|
65
|
+
.attr("y1", "0%")
|
|
66
|
+
.attr("y2", "0%");
|
|
67
|
+
// append multiple color stops by using D3's data/enter step
|
|
68
|
+
linearGradient
|
|
69
|
+
.selectAll("stop")
|
|
70
|
+
.data(itemColor)
|
|
71
|
+
.enter()
|
|
72
|
+
.append("stop")
|
|
73
|
+
.attr("offset", function (data) {
|
|
74
|
+
return data.offset + "%";
|
|
75
|
+
})
|
|
76
|
+
.attr("stop-color", function (data) {
|
|
77
|
+
return data.color;
|
|
78
|
+
});
|
|
79
|
+
// append title
|
|
80
|
+
svgLegend
|
|
81
|
+
.append("text")
|
|
82
|
+
.attr("class", "legendTitle")
|
|
83
|
+
.attr("x", 0)
|
|
84
|
+
.attr("y", 43)
|
|
85
|
+
.style("text-anchor", "left")
|
|
86
|
+
.text(colorsObject.name);
|
|
87
|
+
// draw the rectangle and fill with gradient
|
|
88
|
+
svgLegend
|
|
89
|
+
.append("rect")
|
|
90
|
+
.attr("x", 180)
|
|
91
|
+
.attr("y", 30)
|
|
92
|
+
.attr("width", 150)
|
|
93
|
+
.attr("height", 25)
|
|
94
|
+
.style("fill", "url(#" + currentIndex + ")");
|
|
95
|
+
}
|
|
96
|
+
// continuous legend using d3 colors (linear gradiend code)
|
|
97
|
+
function contD3Legend() {
|
|
98
|
+
const itemColor = [];
|
|
99
|
+
d3ColorScales.forEach((value) => {
|
|
100
|
+
// return the color and offset needed to draw the legend
|
|
101
|
+
itemColor.push(value.colors);
|
|
102
|
+
});
|
|
103
|
+
// create an array of steps based on the color scale
|
|
104
|
+
// returns an array of evenly-spaced numbers. Returns the integers from zero to the specified end minus one.
|
|
105
|
+
// d3.range(start, stop, step)
|
|
106
|
+
var data = d3.range(10).map(d => ({ color: legendColor(d / 10), value: d }));
|
|
107
|
+
// get the array's min and max value
|
|
108
|
+
var extent = d3.extent(data, d => d.value);
|
|
109
|
+
// append a defs (for definition) element to your SVG
|
|
110
|
+
const svgLegend = d3.select(divRef.current)
|
|
111
|
+
.append("svg")
|
|
112
|
+
.style("height", "50px")
|
|
113
|
+
.style("display", "flex");
|
|
114
|
+
const defs = svgLegend.append("defs");
|
|
115
|
+
let currentIndex = "linear-gradient-" + valueIndex;
|
|
116
|
+
// append a linearGradient element to the defs and give it a unique id
|
|
117
|
+
const linearGradient = defs
|
|
118
|
+
.append("linearGradient")
|
|
119
|
+
.attr("id", currentIndex)
|
|
120
|
+
.attr("x1", "0%")
|
|
121
|
+
.attr("x2", "100%") //since it's a horizontal linear gradient
|
|
122
|
+
.attr("y1", "0%")
|
|
123
|
+
.attr("y2", "0%");
|
|
124
|
+
// append multiple color stops by using D3's data/enter step
|
|
125
|
+
linearGradient.selectAll("stop")
|
|
126
|
+
.data(data)
|
|
127
|
+
.enter().append("stop")
|
|
128
|
+
.attr("offset", d => ((d.value - extent[0]) / (extent[1] - extent[0]) * 100) + "%")
|
|
129
|
+
.attr("stop-color", d => d.color);
|
|
130
|
+
// append title
|
|
131
|
+
svgLegend
|
|
132
|
+
.append("text")
|
|
133
|
+
.attr("class", "legendTitle")
|
|
134
|
+
.attr("x", 0)
|
|
135
|
+
.attr("y", 43)
|
|
136
|
+
.style("text-anchor", "left")
|
|
137
|
+
.text(legendColorName);
|
|
138
|
+
// draw the rectangle and fill with gradient
|
|
139
|
+
svgLegend
|
|
140
|
+
.append("rect")
|
|
141
|
+
.attr("x", 180)
|
|
142
|
+
.attr("y", 30)
|
|
143
|
+
.attr("width", 150)
|
|
144
|
+
.attr("height", 25)
|
|
145
|
+
.style("fill", "url(#" + currentIndex + ")");
|
|
146
|
+
}
|
|
147
|
+
// discrete legend using color table colors
|
|
148
|
+
function discColorTableLegend() {
|
|
149
|
+
const itemColor = [];
|
|
150
|
+
const itemName = [];
|
|
151
|
+
colorsObject.color.forEach((element, key) => {
|
|
152
|
+
itemColor.push({ color: RGBToHex(element) });
|
|
153
|
+
itemName.push(key);
|
|
154
|
+
});
|
|
155
|
+
function RGBToHex(rgb) {
|
|
156
|
+
let r = rgb[1].toString(16), g = rgb[2].toString(16), b = rgb[3].toString(16);
|
|
157
|
+
if (r.length == 1)
|
|
158
|
+
r = "0" + r;
|
|
159
|
+
if (g.length == 1)
|
|
160
|
+
g = "0" + g;
|
|
161
|
+
if (b.length == 1)
|
|
162
|
+
b = "0" + b;
|
|
163
|
+
return "#" + r + g + b;
|
|
164
|
+
}
|
|
165
|
+
const ordinalValues = scaleOrdinal().domain(itemName);
|
|
166
|
+
const colorLegend = discreteLegendUtil(itemColor, "ColorSelector").inputScale(ordinalValues);
|
|
167
|
+
select("svg").append("g").attr("transform", "translate(50,70)").attr("class", "legend").call(colorLegend);
|
|
168
|
+
//const calcLegendHeight = 22 * itemColor.length + 4 * itemColor.length;
|
|
169
|
+
const selectedLegend = select(divRef.current);
|
|
170
|
+
selectedLegend
|
|
171
|
+
.append("text")
|
|
172
|
+
.text(legendColorName)
|
|
173
|
+
.attr("y", 7)
|
|
174
|
+
.style("float", "left")
|
|
175
|
+
.style("width", "30%")
|
|
176
|
+
.style("margin", "10px 0px");
|
|
177
|
+
selectedLegend
|
|
178
|
+
.append("svg")
|
|
179
|
+
.style("margin-top", "13px")
|
|
180
|
+
.style("margin-right", "103px")
|
|
181
|
+
.style("float", "right")
|
|
182
|
+
// .style("width", "60%")
|
|
183
|
+
.style("height", "25px")
|
|
184
|
+
.call(colorLegend);
|
|
185
|
+
}
|
|
186
|
+
// discrete legend using d3 colors
|
|
187
|
+
function discD3legend() {
|
|
188
|
+
const itemName = [];
|
|
189
|
+
const itemColor = [];
|
|
190
|
+
colorsObject.forEach((element, key) => {
|
|
191
|
+
itemColor.push({ color: element });
|
|
192
|
+
itemName.push(key);
|
|
193
|
+
});
|
|
194
|
+
const ordinalValues = scaleOrdinal(colorsObject).domain(itemName);
|
|
195
|
+
const discreteLegend = discreteLegendUtil(itemColor, "ColorSelector").inputScale(ordinalValues);
|
|
196
|
+
select("svg").append("g").attr("transform", "translate(50,70)").attr("class", "legend").call(discreteLegend);
|
|
197
|
+
const selectedLegend = select(divRef.current);
|
|
198
|
+
selectedLegend
|
|
199
|
+
.append("text")
|
|
200
|
+
.text(legendColorName)
|
|
201
|
+
.attr("y", 7)
|
|
202
|
+
.style("float", "left")
|
|
203
|
+
.style("width", "30%")
|
|
204
|
+
.style("margin", "10px 0px");
|
|
205
|
+
selectedLegend
|
|
206
|
+
.append("svg")
|
|
207
|
+
.style("margin-top", "13px")
|
|
208
|
+
.style("margin-right", "103px")
|
|
209
|
+
.style("float", "right")
|
|
210
|
+
// .style("width", "60%")
|
|
211
|
+
.style("height", "25px")
|
|
212
|
+
.call(discreteLegend);
|
|
213
|
+
}
|
|
214
|
+
return (React.createElement("div", { style: {
|
|
215
|
+
right: position[0],
|
|
216
|
+
top: position[1],
|
|
217
|
+
borderRadius: "5px",
|
|
218
|
+
height: "35px",
|
|
219
|
+
marginTop: "15px"
|
|
220
|
+
} },
|
|
221
|
+
React.createElement("div", { id: "legend", ref: divRef })));
|
|
222
|
+
};
|
|
223
|
+
// Based on name return the colors array from color.tables.json file
|
|
224
|
+
export function colorTableData(colorName, colorTables) {
|
|
225
|
+
const colorTableData = colorTables.filter((value) => value.name.toLowerCase() == colorName.toLowerCase());
|
|
226
|
+
return colorTableData.length > 0 ? colorTableData[0].colors : [];
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=legendComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legendComponent.js","sourceRoot":"","sources":["../../../src/component/ColorSelector/legendComponent.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,aAAa,EAAC,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAE1C,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AAiBzD,MAAM,CAAC,MAAM,eAAe,GAA0B,CAAC,EACnD,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,GACA,EAAE,EAAE;IAEd,MAAM,MAAM,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAE5C,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,6CAA6C;QAC7C,IAAI,iBAAiB,IAAI,IAAI,IAAI,MAAM,CAAC,OAAO,EAAE;YAC7C,oBAAoB,EAAE,CAAC;YACvB,OAAO,SAAS,OAAO;gBACnB,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK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E,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"}
|
|
@@ -6,7 +6,7 @@ declare type legendProps = {
|
|
|
6
6
|
dataObjectName: string;
|
|
7
7
|
position?: number[] | null;
|
|
8
8
|
colorName: string;
|
|
9
|
-
colorTables: colorTablesArray;
|
|
9
|
+
colorTables: colorTablesArray | string;
|
|
10
10
|
horizontal?: boolean | null;
|
|
11
11
|
};
|
|
12
12
|
export declare const ContinuousLegend: React.FC<legendProps>;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
import * as React from "react";
|
|
2
11
|
import { useRef } from "react";
|
|
3
12
|
import { RGBToHex, colorsArray } from "../Utils/continousLegend";
|
|
@@ -14,74 +23,84 @@ export const ContinuousLegend = ({ min, max, dataObjectName, position, colorName
|
|
|
14
23
|
};
|
|
15
24
|
}, [min, max, colorName, colorTables, horizontal]);
|
|
16
25
|
function continuousLegend() {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const itemColor = [];
|
|
28
|
+
let dataSet;
|
|
29
|
+
if (typeof colorTables === "string") {
|
|
30
|
+
let res = yield fetch(colorTables);
|
|
31
|
+
dataSet = yield res.json();
|
|
32
|
+
}
|
|
33
|
+
// Return the matched colors array from color.tables.json file
|
|
34
|
+
let colorTableColors = typeof colorTables === "string" ?
|
|
35
|
+
colorsArray(colorName, dataSet)
|
|
36
|
+
:
|
|
37
|
+
colorsArray(colorName, colorTables);
|
|
38
|
+
colorTableColors.forEach((value) => {
|
|
39
|
+
// return the color and offset needed to draw the legend
|
|
40
|
+
itemColor.push({
|
|
41
|
+
offset: RGBToHex(value).offset,
|
|
42
|
+
color: RGBToHex(value).color,
|
|
43
|
+
});
|
|
25
44
|
});
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
45
|
+
const colorScale = scaleSequential().domain([min, max]);
|
|
46
|
+
// append a defs (for definition) element to your SVG
|
|
47
|
+
const svgLegend = select(divRef.current)
|
|
48
|
+
.append("svg")
|
|
49
|
+
.style("background-color", "#ffffffcc")
|
|
50
|
+
.style("border-radius", "5px");
|
|
51
|
+
if (!horizontal) {
|
|
52
|
+
svgLegend
|
|
53
|
+
.style("transform", "rotate(270deg)")
|
|
54
|
+
.style("margin-top", "80px");
|
|
55
|
+
}
|
|
56
|
+
const defs = svgLegend.append("defs");
|
|
57
|
+
// append a linearGradient element to the defs and give it a unique id
|
|
58
|
+
const linearGradient = defs
|
|
59
|
+
.append("linearGradient")
|
|
60
|
+
.attr("id", "linear-gradient")
|
|
61
|
+
.attr("x1", "0%")
|
|
62
|
+
.attr("x2", "100%") //since it's a horizontal linear gradient
|
|
63
|
+
.attr("y1", "0%")
|
|
64
|
+
.attr("y2", "0%");
|
|
65
|
+
// append multiple color stops by using D3's data/enter step
|
|
66
|
+
linearGradient
|
|
67
|
+
.selectAll("stop")
|
|
68
|
+
.data(itemColor)
|
|
69
|
+
.enter()
|
|
70
|
+
.append("stop")
|
|
71
|
+
.attr("offset", function (data) {
|
|
72
|
+
return data.offset + "%";
|
|
73
|
+
})
|
|
74
|
+
.attr("stop-color", function (data) {
|
|
75
|
+
return data.color;
|
|
76
|
+
});
|
|
77
|
+
// append title
|
|
34
78
|
svgLegend
|
|
35
|
-
.
|
|
36
|
-
.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
.
|
|
51
|
-
.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
79
|
+
.append("text")
|
|
80
|
+
.attr("class", "legendTitle")
|
|
81
|
+
.attr("x", 25)
|
|
82
|
+
.attr("y", 20)
|
|
83
|
+
.style("text-anchor", "left")
|
|
84
|
+
.text(dataObjectName);
|
|
85
|
+
// draw the rectangle and fill with gradient
|
|
86
|
+
svgLegend
|
|
87
|
+
.append("rect")
|
|
88
|
+
.attr("x", 25)
|
|
89
|
+
.attr("y", 30)
|
|
90
|
+
.attr("width", 250)
|
|
91
|
+
.attr("height", 25)
|
|
92
|
+
.style("fill", "url(#linear-gradient)");
|
|
93
|
+
//create tick marks
|
|
94
|
+
const xLeg = scaleLinear().domain([min, max]).range([10, 258]);
|
|
95
|
+
const axisLeg = axisBottom(xLeg).tickValues(colorScale.domain());
|
|
96
|
+
svgLegend
|
|
97
|
+
.attr("class", "axis")
|
|
98
|
+
.append("g")
|
|
99
|
+
.attr("transform", "translate(15, 55)")
|
|
100
|
+
.style("font-size", "10px")
|
|
101
|
+
.style("font-weight", "700")
|
|
102
|
+
.call(axisLeg);
|
|
58
103
|
});
|
|
59
|
-
// append title
|
|
60
|
-
svgLegend
|
|
61
|
-
.append("text")
|
|
62
|
-
.attr("class", "legendTitle")
|
|
63
|
-
.attr("x", 25)
|
|
64
|
-
.attr("y", 20)
|
|
65
|
-
.style("text-anchor", "left")
|
|
66
|
-
.text(dataObjectName);
|
|
67
|
-
// draw the rectangle and fill with gradient
|
|
68
|
-
svgLegend
|
|
69
|
-
.append("rect")
|
|
70
|
-
.attr("x", 25)
|
|
71
|
-
.attr("y", 30)
|
|
72
|
-
.attr("width", 250)
|
|
73
|
-
.attr("height", 25)
|
|
74
|
-
.style("fill", "url(#linear-gradient)");
|
|
75
|
-
//create tick marks
|
|
76
|
-
const xLeg = scaleLinear().domain([min, max]).range([10, 258]);
|
|
77
|
-
const axisLeg = axisBottom(xLeg).tickValues(colorScale.domain());
|
|
78
|
-
svgLegend
|
|
79
|
-
.attr("class", "axis")
|
|
80
|
-
.append("g")
|
|
81
|
-
.attr("transform", "translate(15, 55)")
|
|
82
|
-
.style("font-size", "10px")
|
|
83
|
-
.style("font-weight", "700")
|
|
84
|
-
.call(axisLeg);
|
|
85
104
|
}
|
|
86
105
|
return (React.createElement("div", { style: {
|
|
87
106
|
position: "absolute",
|
|
@@ -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,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,M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B,CAAC"}
|
|
@@ -7,7 +7,7 @@ declare type colorLegendProps = {
|
|
|
7
7
|
dataObjectName: string;
|
|
8
8
|
position?: number[] | null;
|
|
9
9
|
colorName: string;
|
|
10
|
-
colorTables: colorTablesArray;
|
|
10
|
+
colorTables: colorTablesArray | string;
|
|
11
11
|
horizontal?: boolean | null;
|
|
12
12
|
};
|
|
13
13
|
export declare const DiscreteColorLegend: React.FC<colorLegendProps>;
|