From 76d3b7ebcb14579266b706de10b1bc5a0f95d611 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Thu, 23 Jun 2022 02:17:59 +0300 Subject: [PATCH] feat(charts): normalized stacked bars --- modules/dynamic/overview/charts-overview.js | 110 +++++++++++++------- utils/functionUtils.js | 8 ++ 2 files changed, 81 insertions(+), 37 deletions(-) diff --git a/modules/dynamic/overview/charts-overview.js b/modules/dynamic/overview/charts-overview.js index 012e69de..3418426e 100644 --- a/modules/dynamic/overview/charts-overview.js +++ b/modules/dynamic/overview/charts-overview.js @@ -1,4 +1,4 @@ -import {rollup} from "../../../utils/functionUtils.js"; +import {rollup, rollups} from "../../../utils/functionUtils.js"; import {stack} from "https://cdn.skypack.dev/d3-shape@3"; const entitiesMap = { @@ -195,6 +195,11 @@ const quantizationMap = { } }; +const plotTypeMap = { + stackedBar: {offset: d3.stackOffsetDiverging}, + normalizedStackedBar: {offset: d3.stackOffsetExpand, formatX: value => rn(value * 100) + "%"} +}; + appendStyleSheet(); insertHtml(); addListeners(); @@ -219,9 +224,20 @@ function appendStyleSheet() { #chartsOverview__form { font-size: 1.1em; - margin: 0.3em; - display: flex; - justify-content: space-between; + margin: 0.3em 0; + display: grid; + grid-template-columns: auto auto; + grid-gap: 0.3em; + align-items: start; + justify-items: end; + } + + @media (max-width: 600px) { + #chartsOverview__form { + font-size: 1em; + grid-template-columns: 1fr; + justify-items: normal; + } } #chartsOverview__charts { @@ -256,22 +272,32 @@ function insertHtml() {
+ - by - + - grouped by - + - sorted - +
+ Type + + Columns