Skip to content

Commit f8a2795

Browse files
authored
Merge pull request #878 from cmu-delphi/dlaliberte/correlation5
Indicator Correlation Page
2 parents dccf5f9 + 1b41405 commit f8a2795

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+26207
-263
lines changed

package-lock.json

Lines changed: 21810 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"d3-time": "^2.0.0",
7979
"d3-time-format": "^3.0.0",
8080
"dirty-reprojectors": "0.0.2",
81-
"eslint": "^7.22.0",
81+
"eslint": "^7.23.0",
8282
"eslint-plugin-cypress": "^2.11.2",
8383
"eslint-plugin-svelte3": "^3.1.2",
8484
"file-loader": "^6.2.0",
@@ -97,12 +97,12 @@
9797
"marked": "^2.0.1",
9898
"mini-css-extract-plugin": "^1.3.9",
9999
"node-fetch": "^2.6.1",
100-
"regression": "^2.0.1",
101100
"nouislider": "^14.6.4",
102101
"prettier": "^2.2.1",
103102
"prettier-plugin-svelte": "^2.2.0",
104103
"raw-loader": "^4.0.2",
105104
"regenerator-runtime": "^0.13.7",
105+
"regression": "^2.0.1",
106106
"resize-observer-polyfill": "^1.5.1",
107107
"sass": "^1.32.8",
108108
"sass-loader": "^11.0.1",

src/components/Search.svelte

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,9 @@
359359
class:modern
360360
on:click={onContainerClick}
361361
>
362+
{#if title && modern}
363+
<div class="search-label">{title}</div>
364+
{/if}
362365
{#if !multiple}
363366
<span class="uk-search-icon search-icon" class:modern data-uk-icon="icon: {icon}" />
364367
<input
@@ -548,4 +551,16 @@
548551
padding-top: 4px;
549552
padding-bottom: 4px;
550553
}
554+
555+
.search-label {
556+
font-size: 0.75rem;
557+
line-height: 1;
558+
position: absolute;
559+
top: -0.6rem;
560+
left: 24px;
561+
background: white;
562+
font-weight: 400;
563+
border-radius: 3px;
564+
padding: 2px;
565+
}
551566
</style>

src/components/Vega.svelte

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,11 @@
181181
Object.entries(signals).forEach(([key, v]) => {
182182
const obj = { name: key };
183183
const existing = spec.signals.find((d) => d.name === key);
184-
if (v == null || ['string', 'number', 'boolean'].includes(typeof v) || v instanceof Date || Array.isArray(v)) {
185-
// assume it is a value
186-
obj.value = v;
187-
} else {
184+
if (typeof v === 'function') {
188185
// mixing the whole object
189-
Object.assign(obj, typeof v === 'function' ? v(existing) : v);
186+
Object.assign(obj, v(existing));
187+
} else {
188+
obj.value = v;
190189
}
191190
if (existing) {
192191
Object.assign(existing, obj);

src/components/tooltipUtils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export function createVegaTooltipAdapter(svelteComponent, initialExtraProps = {}
144144
// hide tooltip for null, undefined, or empty string values,
145145
// or when the item's datum.value is null.
146146
const datum = resolveDatum(item);
147-
if (value == null || value === '' || datum.value == null) {
147+
if (value == null || value === '' || (datum.value == null && datum.x == null && datum.y == null)) {
148148
if (isClickingTooltip(event)) {
149149
// ignore
150150
return;

src/components/vegaFactory.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Error, expressionFunction, projection } from 'vega';
55
import { geoAlbersUsaTerritories } from 'geo-albers-usa-territories';
66
import { fitExtent, fitSize, fitWidth, fitHeight } from 'd3-geo/src/projection/fit.js';
77
import { timeDay } from 'd3-time';
8+
import { lagToOffset } from '../data/correlationUtils';
89

910
function patchedAlbersUsaTerritories() {
1011
// see https://github.com/stamen/geo-albers-usa-territories/pull/8/files
@@ -54,6 +55,8 @@ export function cachedNumber(datum, params) {
5455
expressionFunction('cachedTime', cachedTime);
5556
expressionFunction('cachedNumber', cachedNumber);
5657

58+
expressionFunction('lagToOffset', lagToOffset);
59+
5760
/**
5861
* @param {string | HTMLElement} root
5962
* @param {import('vega-embed').VisualizationSpec | string} spec

0 commit comments

Comments
 (0)