You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- replaced the complex 'if' logic in legend row creation with a smarter function, which makes use of new option `legendTemplate`.
- `legendTemplate`: object with distinct formatting for the 'highest', 'middle', 'lowest' classes using properties, which all accept HTML template strings. In the strings, {low} and {high} placeholders can be used, low/high values are understood in the context of the current class interval.
- updated documentation
- updated examples (`points_c` and `combined` both showcase HTML templating)
- `legendTitle <string>`: legend header (usually a description of visualized data, with a unit of measurement). HTML-markdown and styling allowed. To hide header, set this as ''. (by default it inherits target attribute field name, on which the classification is based on)
- `legendAscending <boolean>`: if true, value classes in legend will be ascending (low first, high last) (default: false)
116
+
- `legendTemplate <object>`: custom HTML formatting of legend rows using {high} and {low} placeholders (interpreted as high/low value in the context of a given class interval). Distinct formatting for the highest, lowest and middle class intervals. Middle class format requires both {high} and {low}, highest only {low} and lowest only {high}.
117
+
- `highest <string>`: template for the upper end of classes, "highest value and above" (default: '{low} <')
118
+
- `middle <string>`: template for rows in the middle, "low to high" (default: '{low} – {high}')
119
+
- `lowest <string>`: template for the lower end of classes, "lowest value and below" (default: '< {high}')
110
120
- `unitModifier <object>`: modifies the final class boundary values in order to multiply/divide them by a number. Useful for example when a dataset attribute is in metres, but kilometres would fit the legend better (786000 metres shown as 786 km). Purely visual, only affects legend. Happens after classRounding.
111
121
- `action <string>`: ['divide'|'multiply'] action to take on the number specified by `by`. Required for `unitModifier`.
112
122
- `by <number>`: a number to divide/multiply class boundary values with. Required for `unitModifier`.
legendTemplate: {highest: '{low} and above',lowest: 'under {high}'},
75
76
attribution: "Diesel prices (7-Jul-2023): <a href='https://www.prix-carburants.gouv.fr/rubrique/opendata/'>Ministère de l'Economie, de l'Industrie et du Numérique</a>",
classRounding: null,// class boundary value rounding. Positive numbers round to x decimals, zero will round to whole numbers, negative numbers will round values to the nearest 10, 100, 1000, etc. (default: null - no rounding, values are used as-is)
39
39
unitModifier: null,// modifies the final class boundary values in order to multiply/divide them. Useful when a dataset attribute is in metres, but kilometres would fit the legend better, for example 786000 metres shown as 786 km. Purely visual, only affects legend.
40
40
legendPosition: 'bottomleft',// Legend position (L.control option: 'topleft', 'topright', 'bottomleft' or 'bottomright')
41
+
legendTemplate: {// Legend row template for custom formatting using {high} and {low} placeholders (interpreted as high/low value in the context of a given class). Distinct formatting for the highest, lowest and middle classes (legend rows). Middle class format requires both {high} and {low}, highest only {low} and lowest only {high}
0 commit comments