Skip to content

Commit

Permalink
fix thickness rel
Browse files Browse the repository at this point in the history
  • Loading branch information
neocarto committed Apr 15, 2022
1 parent 6e18ed9 commit 0652a4b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
19 changes: 19 additions & 0 deletions src/helpers/legends.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,24 @@ if (typeof strokeWidth == "object" && strokeWidth.values != undefined && strokeW

}

if (typeof strokeWidth == "object" && strokeWidth.values != undefined && strokeWidth.type == "quali") {
legthicknessquali(selection, {

x: strokeWidth.leg_x,
y: strokeWidth.leg_y,
categories:thickness(geojson.features, strokeWidth).categories,
sizes: thickness(geojson.features, strokeWidth).sizes,
w: strokeWidth.leg_w,
title: strokeWidth.leg_title ?? "Catégories",
fontSize: strokeWidth.leg_fontSize,
fontSize2: strokeWidth.leg_fontSize2,
stroke: strokeWidth.stroke,
strokeOpacity: strokeWidth.strokeOpacity,
txtcol: strokeWidth.leg_txtcol

});

}


}
6 changes: 3 additions & 3 deletions src/helpers/thickness.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@ export function thickness(data, _) {
// Qualitative data (linear scale)

if (typeof _ != "number" && typeof _ != "string" && type == "quali") {
const values = _.values;
const categories = _.categories;
const k = _.k ?? 10;
const sizes = _.sizes ?? d3.quantize(d3.interpolate(1, k), values.length);

return {
type: type,
values: values,
categories: categories,
sizes: sizes,
getthickness: d3
.scaleOrdinal()
.domain(values)
.domain(categories)
.range(sizes)
.unknown("none")
};
Expand Down

0 comments on commit 0652a4b

Please sign in to comment.