Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged d3_changes into develop #45

Merged
merged 5 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,8 @@
"dependencies": {
"@keckelt/tsne": "^1.0.0",
"arquero": "^4.8.0",
"canvas-confetti": "^1.4.0",
"clone": "^2.1.2",
"comlink": "^4.2.0",
"d3-array": "^3.1.4",
"d3-format": "^3.1.0",
"d3-selection": "^3.0.0",
"d3-transition": "^3.0.1",
"jquery": "^3.5.0",
"lineupjs": "4.6.2",
"lodash.merge": "^4.x",
Expand All @@ -77,9 +72,10 @@
"react-dom": "^16.13.0",
"react-router-dom": "^5.2.0",
"split-grid": "^1.0.9",
"tdp_publicdb": "git+ssh://[email protected]:caleydo/tdp_publicdb#develop",
"tdp_core": "git+ssh://[email protected]/datavisyn/tdp_core#develop",
"tdp_publicdb": "git+ssh://[email protected]/caleydo/tdp_publicdb#develop",
"tippy.js": "^6.2.6",
"tourdino": "git+ssh://[email protected]:caleydo/tourdino#develop",
"tourdino": "git+ssh://[email protected]/caleydo/tourdino#develop",
"vega": "~5.20.0",
"vega-embed": "6.19.1",
"vega-functions": "5.12.0",
Expand Down
5 changes: 2 additions & 3 deletions src/CohortRepresentations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import d3 from 'd3';
import {hsl} from 'd3v7';
import tippy from 'tippy.js';
import { Cohort } from './Cohort';
import { IElement, IRectCohortRep } from './CohortInterfaces';
Expand Down Expand Up @@ -300,8 +300,7 @@ export class RectCohortRep implements IRectCohortRep {
this._representation.style.backgroundColor = color;
this._repClone.style.backgroundColor = color;
// font color = white if color is too dark
if (color !== null && color !== 'transparent' && d3.hsl(color).l < 0.6) {
// transparent has lightness of zero
if (color !== null && color !== 'transparent' && hsl(color).l < 0.6) { //transparent has lightness of zero
this._representation.style.color = 'white';
this._repClone.style.color = 'white';
this._removeButton.style.color = 'white';
Expand Down
16 changes: 8 additions & 8 deletions src/Taskview/SearchBar.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { select } from 'd3-selection';
import { IdTextPair, IServerColumn, RestBaseUtils } from 'tdp_core';
import { dataTypes, depletion, IDataSubtypeConfig, IDataTypeConfig } from 'tdp_publicdb';
import { colors } from '../colors';
import { ScoreType } from '../data/Attribute';
import { checkSpecialAttribute, ISpecialAttribute } from '../data/SpecialAttribute';
import { deepCopy, getAnimatedLoadingText, log } from '../util';
import { niceName } from '../utilLabels';
import {select} from 'd3v7';
import {IdTextPair, IServerColumn, RestBaseUtils} from 'tdp_core';
import {dataTypes, depletion, IDataSubtypeConfig, IDataTypeConfig} from 'tdp_publicdb';
import {colors} from '../colors';
import {ScoreType} from '../data/Attribute';
import {checkSpecialAttribute, ISpecialAttribute} from '../data/SpecialAttribute';
import {deepCopy, getAnimatedLoadingText, log} from '../util';
import {niceName} from '../utilLabels';

export class SearchBar {
private _container: HTMLDivElement;
Expand Down
2 changes: 1 addition & 1 deletion src/Taskview/SearchColumn.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { select } from 'd3-selection';
import {select} from 'd3v7';
import * as $ from 'jquery';
import tippy from 'tippy.js';
import { Cohort } from '../Cohort';
Expand Down
15 changes: 8 additions & 7 deletions src/Taskview/columns/AColumn.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { select } from 'd3-selection';
import { Cohort, EMPTY_COHORT_ID, LOADER_COHORT_ID } from '../../Cohort';
import { colors } from '../../colors';
import { createSearchBarTooltip } from '../../Tooltip';
import { getAnimatedLoadingBars, log } from '../../util';
import { ColumnCloseEvent } from '../../utilCustomEvents';
import Taskview, { InputCohort, OutputCohort } from '../Taskview';
import {select} from 'd3v7';
import {Cohort, EMPTY_COHORT_ID, LOADER_COHORT_ID} from '../../Cohort';
import {colors} from '../../colors';
import {createSearchBarTooltip} from '../../Tooltip';
import {getAnimatedLoadingBars, log} from '../../util';
import {ColumnCloseEvent} from '../../utilCustomEvents';
import Taskview, {InputCohort, OutputCohort} from '../Taskview';


export abstract class AColumn {
$column: HTMLDivElement;
Expand Down
2 changes: 1 addition & 1 deletion src/Taskview/columns/AttributeColumn.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { select } from 'd3-selection';
import {select} from 'd3v7';
import vegaEmbed from 'vega-embed';
import { TopLevelSpec as VegaLiteSpec } from 'vega-lite';
import { Cohort } from '../../Cohort';
Expand Down
12 changes: 6 additions & 6 deletions src/Taskview/columns/CohortColumn.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { select } from 'd3-selection';
import { Cohort } from '../../Cohort';
import { OnboardingManager } from '../../OnboardingManager';
import { SortType } from '../../util';
import { ColumnSortEvent } from '../../utilCustomEvents';
import { ADataColumn } from './AColumn';
import {select} from 'd3v7';
import {Cohort} from '../../Cohort';
import {OnboardingManager} from '../../OnboardingManager';
import {SortType} from '../../util';
import {ColumnSortEvent} from '../../utilCustomEvents';
import {ADataColumn} from './AColumn';

/**
* Displays cohorts with their given representation as a column
Expand Down
6 changes: 3 additions & 3 deletions src/Taskview/columns/NumberColumn.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { format as d3Format } from 'd3-format';
import { Cohort } from '../../Cohort';
import { ADataColumn } from './AColumn';
import {format as d3Format} from 'd3v7';
import {Cohort} from '../../Cohort';
import {ADataColumn} from './AColumn';

export default class NumberColumn extends ADataColumn {
constructor($container: HTMLDivElement) {
Expand Down
8 changes: 4 additions & 4 deletions src/Taskview/tasks/ATask.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { select, Selection } from 'd3-selection';
import { ICohort } from '../../CohortInterfaces';
import { IAttribute } from '../../data/Attribute';
import { OnboardingManager } from '../../OnboardingManager';
import {select, Selection} from 'd3v7';
import {ICohort} from '../../CohortInterfaces';
import {IAttribute} from '../../data/Attribute';
import {OnboardingManager} from '../../OnboardingManager';

export const TASK_CLOSE_EVENT_TYPE = 'task:close';

Expand Down
28 changes: 12 additions & 16 deletions src/Taskview/tasks/Compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
* Licensed under the new BSD license, available at http://caleydo.org/license
**************************************************************************** */

import * as d3 from 'd3';
import { select, Selection } from 'd3-selection';
import { IMeasureResult, IMeasureVisualization, ISetParameters, ISimilarityMeasure, MethodManager, SCOPE, Type, WorkerManager } from 'tourdino';
import { Cohort } from '../../Cohort';
import { Attribute, IAttribute } from '../../data/Attribute';
import { log } from '../../util';
import { ATask } from './ATask';

import {hsl, scaleLinear, select, Selection} from 'd3v7';
import * as d3v3 from 'd3v3';
import {IMeasureResult, IMeasureVisualization, ISetParameters, ISimilarityMeasure, MethodManager, SCOPE, Type, WorkerManager} from 'tourdino';
import {Cohort} from '../../Cohort';
import {Attribute, IAttribute} from '../../data/Attribute';
import {log} from '../../util';
import {ATask} from './ATask';

export class Compare extends ATask {
public label = `Compare`;
Expand Down Expand Up @@ -117,8 +118,7 @@ export class Compare extends ATask {
const parent = select(this).node().parentNode as HTMLElement; // parent span-element
select(parent).style('background-color', (d) => (d as Cohort).colorTaskView);
let color = '#333333';
if (d && d.colorTaskView && d.colorTaskView !== 'transparent' && d3.hsl(d.colorTaskView).l < 0.5) {
// transparent has lightness of zero
if (d && d.colorTaskView && 'transparent' !== d.colorTaskView && hsl(d.colorTaskView).l < 0.5) { //transparent has lightness of zero
color = 'white';
}
select(parent.parentNode as HTMLElement)
Expand Down Expand Up @@ -504,7 +504,7 @@ export class Compare extends ATask {
if (measure.visualization) {
const { visualization } = measure;
if (cellData.setParameters) {
const d3v3Details = d3.select(details.node());
const d3v3Details = d3v3.select(details.node());
visualization.generateVisualization(d3v3Details, cellData.setParameters, cellData.score);
}
}
Expand Down Expand Up @@ -744,8 +744,7 @@ interface IHighlightData {

export function textColor4Background(backgroundColor: string) {
let color = '#333333';
if (backgroundColor !== 'transparent' && d3.hsl(backgroundColor).l < 0.5) {
// transparent has lightness of zero
if ('transparent' !== backgroundColor && hsl(backgroundColor).l < 0.5) { //transparent has lightness of zero
color = 'white';
}

Expand All @@ -758,10 +757,7 @@ export function score2color(score: number): { background: string; foreground: st

if (score <= 0.05) {
// log.debug('bg color cahnge')
const calcColor = d3.scale
.linear()
.domain([0, 0.05])
.range(<any[]>['#000000', '#FFFFFF']);
const calcColor = scaleLinear().domain([0, 0.05]).range(<any[]>['#000000', '#FFFFFF']);

background = calcColor(score).toString();
foreground = textColor4Background(background);
Expand Down
2 changes: 1 addition & 1 deletion src/Taskview/tasks/Details.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as aq from 'arquero';
import { select } from 'd3-selection';
import {select} from 'd3v7';
import * as LineUpJS from 'lineupjs';
import { Cohort } from '../../Cohort';
import { ICohort } from '../../CohortInterfaces';
Expand Down
27 changes: 14 additions & 13 deletions src/Taskview/tasks/Filter.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { Selection } from 'd3-selection';
import { ICohort } from '../../CohortInterfaces';
import { IAttribute } from '../../data/Attribute';
import { getAnimatedLoadingText, log } from '../../util';
import { AreaChart } from '../visualizations/AreaChart';
import { AVegaVisualization } from '../visualizations/AVegaVisualization';
import { Option, OptionGroup, VisConfig } from '../visualizations/config/VisConfig';
import { DensityPlot } from '../visualizations/DensityPlot';
import { GroupedBoxplot } from '../visualizations/GroupedBoxplot';
import { VegaGroupedHistogram } from '../visualizations/GroupedHistogram';
import { KaplanMeierPlot } from '../visualizations/KaplanMeierPlot';
import { Scatterplot } from '../visualizations/Scatterplot';
import { ATask } from './ATask';

import {Selection} from 'd3v7';
import {ICohort} from '../../CohortInterfaces';
import {IAttribute} from '../../data/Attribute';
import {getAnimatedLoadingText, log} from '../../util';
import {AreaChart} from '../visualizations/AreaChart';
import {AVegaVisualization} from '../visualizations/AVegaVisualization';
import {Option, OptionGroup, VisConfig} from '../visualizations/config/VisConfig';
import {DensityPlot} from '../visualizations/DensityPlot';
import {GroupedBoxplot} from '../visualizations/GroupedBoxplot';
import {VegaGroupedHistogram} from '../visualizations/GroupedHistogram';
import {KaplanMeierPlot} from '../visualizations/KaplanMeierPlot';
import {Scatterplot} from '../visualizations/Scatterplot';
import {ATask} from './ATask';

export class Filter extends ATask {
public label = `View, Filter & Split`;
Expand Down
4 changes: 1 addition & 3 deletions src/Taskview/tasks/Prevalence.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { format } from 'd3-format';
import { select } from 'd3-selection';
import { transition } from 'd3-transition';
import {format, select, transition} from 'd3v7';
import tippy from 'tippy.js';
import { Cohort, IBloodlineElement } from '../../Cohort';
import { ICohort } from '../../CohortInterfaces';
Expand Down
5 changes: 2 additions & 3 deletions src/Taskview/visualizations/AVegaVisualization.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { format } from 'd3-format';
import { select } from 'd3-selection';
import { cloneDeep } from 'lodash';
import {format, select} from 'd3v7';
import {cloneDeep} from 'lodash';
import tippy from 'tippy.js';
import { View as VegaView } from 'vega';
import vegaEmbed from 'vega-embed';
Expand Down
3 changes: 1 addition & 2 deletions src/Taskview/visualizations/DensityPlot.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { format } from 'd3-format';
import { select } from 'd3-selection';
import {format, select} from 'd3v7';
import log from 'loglevel';
import { Spec as VegaSpec } from 'vega';
import { TopLevelSpec as VegaLiteSpec } from 'vega-lite';
Expand Down
3 changes: 1 addition & 2 deletions src/Taskview/visualizations/GroupedBoxplot.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { format } from 'd3-format';
import { select } from 'd3-selection';
import {format, select} from 'd3v7';
import log from 'loglevel';
import { Spec as VegaSpec } from 'vega';
import { TopLevelSpec as VegaLiteSpec } from 'vega-lite';
Expand Down
22 changes: 11 additions & 11 deletions src/Taskview/visualizations/KaplanMeierPlot.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import log from 'loglevel';
import { select } from 'd3-selection';
import { TopLevelSpec as VegaLiteSpec } from 'vega-lite';
import { Spec as VegaSpec, None } from 'vega';
import { desc, op, from, rolling, table, not } from 'arquero';
import { OrderKeys, ExprList } from 'arquero/dist/types/table/transformable';
import { IdValuePair, ServerColumnAttribute } from '../../data/Attribute';
import { DATA_LABEL } from './constants';
import { getCohortLabel, getCohortLabels } from '../../Cohort';
import { SingleAttributeVisualization, AVegaVisualization } from './AVegaVisualization';
import { ICohort } from '../../CohortInterfaces';
import { confidenceToggleGroup, confidenceNone } from './config/ConfidenceConfig';
import {select} from 'd3v7';
import {TopLevelSpec as VegaLiteSpec} from 'vega-lite';
import {Spec as VegaSpec, None} from 'vega';
import {IdValuePair, ServerColumnAttribute} from '../../data/Attribute';
import {DATA_LABEL} from './constants';
import {desc, op, from, rolling, table, not} from 'arquero';
import {getCohortLabel, getCohortLabels} from '../../Cohort';
import {SingleAttributeVisualization, AVegaVisualization} from './AVegaVisualization';
import {ICohort} from '../../CohortInterfaces';
import {OrderKeys, ExprList} from 'arquero/dist/types/table/transformable';
import {confidenceToggleGroup, confidenceNone} from './config/ConfidenceConfig';
import confidenceIcon from '../../assets/icons/confidence.svg';

export class KaplanMeierPlot extends SingleAttributeVisualization {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as aq from 'arquero';
import { format } from 'd3-format';
import { select } from 'd3-selection';
import {format, select} from 'd3v7';
import tippy from 'tippy.js';
import vegaEmbed from 'vega-embed';
import { TopLevelSpec as VegaLiteSpec } from 'vega-lite';
Expand Down
24 changes: 12 additions & 12 deletions src/Taskview/visualizations/Scatterplot.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import * as Comlink from 'comlink';
import { select } from 'd3-selection';
import { Spec as VegaSpec } from 'vega';
import { TopLevelSpec as VegaLiteSpec } from 'vega-lite';
import { TopLevel, LayerSpec } from 'vega-lite/build/src/spec';
import { Field } from 'vega-lite/build/src/channeldef';
import { Cohort } from '../../Cohort';
import { AttributeType, IAttribute, IdValuePair, ServerColumnAttribute } from '../../data/Attribute';
import { NumRangeOperators } from '../../rest';
import { IFilterDesc, inRange } from '../../util';
import { FilterEvent } from '../../utilCustomEvents';
import { DATA_LABEL } from './constants';
import { AxisType, MultiAttributeVisualization } from './MultiAttributeVisualization';
import {select} from 'd3v7';
import {Spec as VegaSpec} from 'vega';
import {TopLevelSpec as VegaLiteSpec} from 'vega-lite';
import {Cohort} from '../../Cohort';
import {AttributeType, IAttribute, IdValuePair, ServerColumnAttribute} from '../../data/Attribute';
import {NumRangeOperators} from '../../rest';
import {IFilterDesc, inRange} from '../../util';
import {FilterEvent} from '../../utilCustomEvents';
import {DATA_LABEL} from './constants';
import {AxisType, MultiAttributeVisualization} from './MultiAttributeVisualization';
import {TopLevel, LayerSpec} from 'vega-lite/build/src/spec';
import {Field} from 'vega-lite/build/src/channeldef';

export class Scatterplot extends MultiAttributeVisualization {
static readonly NAME: string = 'Scatterplot';
Expand Down
2 changes: 1 addition & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { select, Selection } from 'd3-selection';
import {select, Selection} from 'd3v7';
import SplitGrid from 'split-grid';
import {
AppContext,
Expand Down
2 changes: 1 addition & 1 deletion src/common/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export const gene: IDataSourceConfig = {
ColumnDescUtils.stringCol('symbol', { label: 'Symbol', width: 120 }),
ColumnDescUtils.stringCol('id', { label: 'Ensembl' }),
ColumnDescUtils.stringCol('name', { label: 'Name' }),
ColumnDescUtils.categoricalCol('chromosome', toChromosomes(find('chromosome').categories), { label: 'Chromosome' }),
ColumnDescUtils.categoricalCol('chromosome', toChromosomes(find('chromosome').categories as string[]), { label: 'Chromosome' }),
ColumnDescUtils.categoricalCol('biotype', find('biotype').categories, { label: 'Biotype' }),
ColumnDescUtils.categoricalCol(
'strand',
Expand Down
2 changes: 1 addition & 1 deletion src/data/Attribute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export class ServerColumnAttribute extends Attribute {
constructor(public readonly id: string, public readonly view: string, public readonly database: string, readonly serverColumn: IServerColumn) {
super(id, view, database, serverColumn.type);
this.label = niceName(serverColumn.label);
this.categories = serverColumn.categories;
this.categories = serverColumn.categories as string[];
}

async filter(cht: Cohort, filter: INumRange[] | IEqualsList, rangeLabel?: string): Promise<Cohort> {
Expand Down
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ export * from './cohortview';
export * from './rest';

export * from './util';
export * from './utils';
2 changes: 1 addition & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { select, Selection } from 'd3-selection';
import {select, Selection} from 'd3v7';
import * as logger from 'loglevel';
import { NotificationHandler } from 'tdp_core';
import { ICohort } from './CohortInterfaces';
Expand Down
4 changes: 2 additions & 2 deletions src/utilLabels.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { format } from 'd3-format';
import { IEqualsList, INumRange, isEqualsList, isNumRangeFilter, NumRangeOperators } from './rest';
import {format} from 'd3v7';
import {IEqualsList, INumRange, isEqualsList, isNumRangeFilter, NumRangeOperators} from './rest';

export function niceName(label: string): string {
return label
Expand Down
16 changes: 0 additions & 16 deletions src/utils/RouterScrollToTop.tsx

This file was deleted.

1 change: 0 additions & 1 deletion src/utils/index.ts

This file was deleted.