From d1a50e66161e4daaadbd8f1b8871b1aa6d985288 Mon Sep 17 00:00:00 2001 From: Marvin Scham Date: Mon, 29 Aug 2022 06:03:09 +0200 Subject: [PATCH] Unified max value handling --- basic-example/basic-example.js | 2 +- basic-example/basic-example.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/basic-example/basic-example.js b/basic-example/basic-example.js index 652ec15..5bcfb8f 100644 --- a/basic-example/basic-example.js +++ b/basic-example/basic-example.js @@ -29,7 +29,7 @@ fetch(url) const fn = (d) => d.count; const data = d3.pie().value(fn)(langInfoPrepped); - const maxVal = d3.max(data, function (d) { return d.value; }); + const maxVal = d3.max(langInfoPrepped, fn); const colorScale = d3.scaleLinear().domain([0, maxVal]).range(["azure", "teal"]); const arc = d3 diff --git a/basic-example/basic-example.py b/basic-example/basic-example.py index 9483c02..056a077 100644 --- a/basic-example/basic-example.py +++ b/basic-example/basic-example.py @@ -28,7 +28,7 @@ for lang in lang_info: fn = create_proxy(lambda d, *_: d["count"]) data = d3.pie().value(fn)(to_js(lang_info_prepped)) -max_val = max(lang_info_prepped, key=lambda d: d["count"])["count"] +max_val = d3.max(to_js(lang_info_prepped), fn) color_scale = d3.scaleLinear().domain([0, max_val]).range(["azure", "teal"]) arc = (