gridviz 3.0.13 → 3.0.15
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/gridviz.js +11 -10
- package/dist/gridviz.min.js +1 -1
- package/package.json +1 -1
- package/src/legend/TernaryLegend.js +3 -3
- package/src/utils/ternary.js +7 -6
package/package.json
CHANGED
|
@@ -113,15 +113,15 @@ export class TernaryLegend extends Legend {
|
|
|
113
113
|
//triangle s0
|
|
114
114
|
const t0_ = g.append('polygon')
|
|
115
115
|
.attr('points', w / 2 + "," + h * 2 / 3 + " " + w * 5 / 6 + "," + h * 2 / 3 + " " + w * 2 / 3 + "," + h / 3)
|
|
116
|
-
setAttributes(t0_, classifier.mixColors[0], texts["
|
|
116
|
+
setAttributes(t0_, classifier.mixColors[0], texts["m12"])
|
|
117
117
|
//triangle s1
|
|
118
118
|
const t1_ = g.append('polygon')
|
|
119
119
|
.attr('points', w / 2 + "," + h * 2 / 3 + " " + w / 3 + "," + h + " " + w * 2 / 3 + "," + h)
|
|
120
|
-
setAttributes(t1_, classifier.mixColors[1], texts["
|
|
120
|
+
setAttributes(t1_, classifier.mixColors[1], texts["m02"])
|
|
121
121
|
//triangle s2
|
|
122
122
|
const t2_ = g.append('polygon')
|
|
123
123
|
.attr('points', w / 2 + "," + h * 2 / 3 + " " + w / 6 + "," + h * 2 / 3 + " " + w / 3 + "," + h / 3)
|
|
124
|
-
setAttributes(t2_, classifier.mixColors[2], texts["
|
|
124
|
+
setAttributes(t2_, classifier.mixColors[2], texts["m01"])
|
|
125
125
|
|
|
126
126
|
//center
|
|
127
127
|
if (this.centerCoefficient) {
|
package/src/utils/ternary.js
CHANGED
|
@@ -53,21 +53,21 @@ export const ternaryClassifier = (properties, totalFunction, opts = {}) => {
|
|
|
53
53
|
if (s0 <= c0 && s1 >= c1 && s2 >= c2) {
|
|
54
54
|
//central class
|
|
55
55
|
if (cc != undefined && s0 > cc * c0) return "center"
|
|
56
|
-
if (withMixedClasses) return "
|
|
56
|
+
if (withMixedClasses) return "m12"
|
|
57
57
|
return s1 > s2 ? "1" : "2"
|
|
58
58
|
}
|
|
59
59
|
//middle class 1 - intersection class 0 and 1
|
|
60
60
|
if (s0 >= c0 && s1 <= c1 && s2 >= c2) {
|
|
61
61
|
//central class
|
|
62
62
|
if (cc != undefined && s1 > cc * c1) return "center"
|
|
63
|
-
if (withMixedClasses) return "
|
|
63
|
+
if (withMixedClasses) return "m02"
|
|
64
64
|
return s0 > s2 ? "0" : "2"
|
|
65
65
|
}
|
|
66
66
|
//middle class 2 - intersection class 0 and 1
|
|
67
67
|
if (s0 >= c0 && s1 >= c1 && s2 <= c2) {
|
|
68
68
|
//central class
|
|
69
69
|
if (cc != undefined && s2 > cc * c2) return "center"
|
|
70
|
-
if (withMixedClasses) return "
|
|
70
|
+
if (withMixedClasses) return "m01"
|
|
71
71
|
return s1 > s0 ? "1" : "0"
|
|
72
72
|
}
|
|
73
73
|
//should not happen
|
|
@@ -110,9 +110,9 @@ export const ternaryColorClassifier = (properties, totalFunction, colors, opts =
|
|
|
110
110
|
if (cla == "0") return color0
|
|
111
111
|
if (cla == "1") return color1
|
|
112
112
|
if (cla == "2") return color2
|
|
113
|
-
if (cla == "
|
|
114
|
-
if (cla == "
|
|
115
|
-
if (cla == "
|
|
113
|
+
if (cla == "m12") return mixColor0
|
|
114
|
+
if (cla == "m02") return mixColor1
|
|
115
|
+
if (cla == "m01") return mixColor2
|
|
116
116
|
if (cla == "center") return centerColor
|
|
117
117
|
return opts.defaultColor || "black"
|
|
118
118
|
}
|
|
@@ -121,6 +121,7 @@ export const ternaryColorClassifier = (properties, totalFunction, colors, opts =
|
|
|
121
121
|
fun.colors = [color0, color1, color2]
|
|
122
122
|
fun.mixColors = [mixColor0, mixColor1, mixColor2]
|
|
123
123
|
fun.centerColor = centerColor
|
|
124
|
+
fun.classifier = classifier
|
|
124
125
|
|
|
125
126
|
return fun
|
|
126
127
|
}
|