Skip to content

Commit

Permalink
Release 14.0.2 (#577)
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkh authored Oct 18, 2024
2 parents 9269fad + 7acc430 commit eee23a1
Show file tree
Hide file tree
Showing 13 changed files with 954 additions and 932 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
release:
uses: datavisyn/github-workflows/.github/workflows/release-source.yml@feat-automate-releases-releasenotes
secrets: inherit
uses: datavisyn/github-workflows/.github/workflows/release-source.yml@main
secrets: inherit
with:
release_version: ${{ inputs.release_version }}
894 changes: 0 additions & 894 deletions .yarn/releases/yarn-4.3.0.cjs

This file was deleted.

925 changes: 925 additions & 0 deletions .yarn/releases/yarn-4.5.0.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.3.0.cjs
yarnPath: .yarn/releases/yarn-4.5.0.cjs
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "visyn_core",
"description": "Core repository for datavisyn applications.",
"version": "14.0.1",
"version": "14.0.2",
"author": {
"name": "datavisyn GmbH",
"email": "[email protected]",
Expand Down Expand Up @@ -154,5 +154,5 @@
}
}
},
"packageManager": "yarn@4.3.0"
"packageManager": "yarn@4.5.0"
}
1 change: 0 additions & 1 deletion src/demo/MainApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export function MainApp() {
shape: null,
dragMode: EScatterSelectSettings.RECTANGLE,
alphaSliderVal: 1,
sizeSliderVal: 5,
showLabels: ELabelingOptions.SELECTED,
showLabelLimit: 20,
regressionLineOptions: {
Expand Down
5 changes: 0 additions & 5 deletions src/vis/scatter/Regression.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,6 @@ const methods = {
},
};

const regressionMethodsMapping = {
[ERegressionLineType.LINEAR]: 'linear',
[ERegressionLineType.POLYNOMIAL]: 'polynomial',
};

export const fitRegressionLine = (
data: { x: number[]; y: number[] },
method: ERegressionLineType,
Expand Down
13 changes: 6 additions & 7 deletions src/vis/scatter/ScatterVis.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable react-compiler/react-compiler */
import { useElementSize, useResizeObserver, useWindowEvent } from '@mantine/hooks';
import { useElementSize, useWindowEvent } from '@mantine/hooks';
import { Center, Group, Stack, Switch, Tooltip, ScrollArea } from '@mantine/core';
import * as React from 'react';
import cloneDeep from 'lodash/cloneDeep';
Expand All @@ -14,8 +14,6 @@ import { EColumnTypes, ENumericalColorScaleType, EScatterSelectSettings, ICommon
import { BrushOptionButtons } from '../sidebar/BrushOptionButtons';
import { ERegressionLineType, IInternalScatterConfig, IRegressionResult } from './interfaces';
import { defaultRegressionLineStyle, fetchColumnData, regressionToAnnotation } from './utils';
import { getLabelOrUnknown } from '../general/utils';
import { truncateText } from '../general/layoutUtils';
import { fitRegressionLine } from './Regression';
import { useDataPreparation } from './useDataPreparation';
import { InvalidCols } from '../general/InvalidCols';
Expand Down Expand Up @@ -192,7 +190,7 @@ export function ScatterVis({
},
],
results: [curveFit],
annotations: [regressionToAnnotation(curveFit, 3, 'x', 'y')],
annotations: config.regressionLineOptions.showStats !== false ? [regressionToAnnotation(curveFit, 3, 'x', 'y')] : [],
};
}
}
Expand Down Expand Up @@ -232,9 +230,9 @@ export function ScatterVis({
const results: IRegressionResult[] = [];
const plotlyShapes: Partial<PlotlyTypes.Shape>[] = [];
// eslint-disable-next-line guard-for-in
splom.xyPairs.forEach((pair, i) => {
splom.xyPairs.forEach((pair) => {
const curveFit = fitRegressionLine(
{ x: pair.data.x.filter((x) => x), y: pair.data.y.filter((y) => y) },
{ x: pair.data.validIndices.map((i) => pair.data.x[i]), y: pair.data.validIndices.map((i) => pair.data.y[i]) },
config.regressionLineOptions.type,
pair.xref,
pair.yref,
Expand Down Expand Up @@ -264,6 +262,7 @@ export function ScatterVis({
config.regressionLineOptions.type,
config.regressionLineOptions.fitOptions,
config.regressionLineOptions.lineStyle,
config.regressionLineOptions.showStats,
subplots,
scatter,
facet,
Expand Down Expand Up @@ -467,7 +466,7 @@ export function ScatterVis({
</div>
) : null}

<div ref={ref} style={{ gridArea: 'plot', overflow: 'hidden' }}>
<div ref={ref} style={{ gridArea: 'plot', overflow: 'hidden', paddingBottom: '0.5rem' }}>
{status === 'success' && layout ? (
<PlotlyComponent
data-testid="ScatterPlotTestId"
Expand Down
1 change: 0 additions & 1 deletion src/vis/scatter/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export interface IScatterConfig extends BaseVisConfig {
shape: ColumnInfo | null;
dragMode: EScatterSelectSettings;
alphaSliderVal: number;
sizeSliderVal: number;
showLabels: ELabelingOptions;
showLabelLimit?: number;
regressionLineOptions?: IRegressionLineOptions;
Expand Down
20 changes: 10 additions & 10 deletions src/vis/scatter/useData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export function useData({
subplots?: ReturnType<typeof useDataPreparation>['subplots'];
selectedList: string[];
shapeScale: (val: string) => string;
mappingFunction?: (val: string | number) => string;
mappingFunction?: (val: string | number | null | undefined) => string;
}) {
return React.useMemo<PlotlyTypes.Data[]>(() => {
if (status !== 'success' || !value) {
Expand Down Expand Up @@ -93,8 +93,8 @@ export function useData({
hovertext: subplots.ids.map((p_id, index) =>
`${value.idToLabelMapper(p_id)}
${(value.resolvedLabelColumnsWithMappedValues ?? []).map((l) => `<br />${columnNameWithDescription(l.info)}: ${getLabelOrUnknown(l.mappedValues.get(p_id))}`)}
${value.colorColumn ? `<br />${columnNameWithDescription(value.colorColumn.info)}: ${getLabelOrUnknown(value.colorColumn.resolvedValues[index].val)}` : ''}
${value.shapeColumn && value.shapeColumn.info.id !== value.colorColumn?.info.id ? `<br />${columnNameWithDescription(value.shapeColumn.info)}: ${getLabelOrUnknown(value.shapeColumn.resolvedValues[index].val)}` : ''}`.trim(),
${value.colorColumn ? `<br />${columnNameWithDescription(value.colorColumn.info)}: ${getLabelOrUnknown(value.colorColumn.resolvedValues[index]?.val)}` : ''}
${value.shapeColumn && value.shapeColumn.info.id !== value.colorColumn?.info.id ? `<br />${columnNameWithDescription(value.shapeColumn.info)}: ${getLabelOrUnknown(value.shapeColumn.resolvedValues[index]?.val)}` : ''}`.trim(),
),
marker: {
color: value.colorColumn && mappingFunction ? value.colorColumn.resolvedValues.map((v) => mappingFunction(v.val)) : VIS_NEUTRAL_COLOR,
Expand Down Expand Up @@ -134,9 +134,9 @@ export function useData({
}),
hovertext: value.validColumns[0].resolvedValues.map((v, i) =>
`${value.idToLabelMapper(v.id)}
${(value.resolvedLabelColumns ?? []).map((l) => `<br />${columnNameWithDescription(l.info)}: ${getLabelOrUnknown(l.resolvedValues[i].val)}`)}
${value.colorColumn ? `<br />${columnNameWithDescription(value.colorColumn.info)}: ${getLabelOrUnknown(value.colorColumn.resolvedValues[i].val)}` : ''}
${value.shapeColumn && value.shapeColumn.info.id !== value.colorColumn?.info.id ? `<br />${columnNameWithDescription(value.shapeColumn.info)}: ${getLabelOrUnknown(value.shapeColumn.resolvedValues[i].val)}` : ''}`.trim(),
${(value.resolvedLabelColumns ?? []).map((l) => `<br />${columnNameWithDescription(l.info)}: ${getLabelOrUnknown(l.resolvedValues[i]?.val)}`)}
${value.colorColumn ? `<br />${columnNameWithDescription(value.colorColumn.info)}: ${getLabelOrUnknown(value.colorColumn.resolvedValues[i]?.val)}` : ''}
${value.shapeColumn && value.shapeColumn.info.id !== value.colorColumn?.info.id ? `<br />${columnNameWithDescription(value.shapeColumn.info)}: ${getLabelOrUnknown(value.shapeColumn.resolvedValues[i]?.val)}` : ''}`.trim(),
),
marker: {
textfont: {
Expand Down Expand Up @@ -195,7 +195,7 @@ export function useData({
return plots;
}

if (splom) {
if (splom && value.validColumns[0]) {
// SPLOM case
const plotlyDimensions = value.validColumns.map((col) => ({
label: col.info.name,
Expand All @@ -215,9 +215,9 @@ export function useData({
dimensions: plotlyDimensions,
hovertext: value.validColumns[0].resolvedValues.map((v, i) =>
`${value.idToLabelMapper(v.id)}
${(value.resolvedLabelColumns ?? []).map((l) => `<br />${columnNameWithDescription(l.info)}: ${getLabelOrUnknown(l.resolvedValues[i].val)}`)}
${value.colorColumn ? `<br />${columnNameWithDescription(value.colorColumn.info)}: ${getLabelOrUnknown(value.colorColumn.resolvedValues[i].val)}` : ''}
${value.shapeColumn && value.shapeColumn.info.id !== value.colorColumn?.info.id ? `<br />${columnNameWithDescription(value.shapeColumn.info)}: ${getLabelOrUnknown(value.shapeColumn.resolvedValues[i].val)}` : ''}`.trim(),
${(value.resolvedLabelColumns ?? []).map((l) => `<br />${columnNameWithDescription(l.info)}: ${getLabelOrUnknown(l.resolvedValues[i]?.val)}`)}
${value.colorColumn ? `<br />${columnNameWithDescription(value.colorColumn.info)}: ${getLabelOrUnknown(value.colorColumn.resolvedValues[i]?.val)}` : ''}
${value.shapeColumn && value.shapeColumn.info.id !== value.colorColumn?.info.id ? `<br />${columnNameWithDescription(value.shapeColumn.info)}: ${getLabelOrUnknown(value.shapeColumn.resolvedValues[i]?.val)}` : ''}`.trim(),
),
...(isEmpty(selectedList) ? {} : { selectedpoints: selectedList.map((idx) => splom.idToIndex.get(idx)) }),
marker: {
Expand Down
3 changes: 1 addition & 2 deletions src/vis/scatter/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export const defaultConfig: IScatterConfig = {
shape: null,
dragMode: EScatterSelectSettings.RECTANGLE,
alphaSliderVal: 0.5,
sizeSliderVal: 8,
subplots: undefined,
showLabels: ELabelingOptions.NEVER,
showLabelLimit: 50,
Expand Down Expand Up @@ -181,7 +180,7 @@ export function regressionToAnnotation(r: IRegressionResult, precision: number,
xanchor: 'left',
yanchor: 'top',
bgcolor: 'rgba(255, 255, 255, 0.8)',
xshift: 5,
xshift: 10,
yshift: -5,
};
}
2 changes: 0 additions & 2 deletions src/vis/stories/Vis/Scatter/ScatterIris.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ Basic.args = {
],
color: null,
facets: null,
sizeSliderVal: 8,
numColorScaleType: ENumericalColorScaleType.SEQUENTIAL,
shape: null,
dragMode: EScatterSelectSettings.RECTANGLE,
Expand Down Expand Up @@ -152,7 +151,6 @@ ControlledSubplots.args = {
},
],
facets: null,
sizeSliderVal: 8,
numColorScaleType: ENumericalColorScaleType.SEQUENTIAL,
shape: null,
dragMode: EScatterSelectSettings.RECTANGLE,
Expand Down
12 changes: 7 additions & 5 deletions src/vis/vishooks/hooks/useChart.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable react-compiler/react-compiler */
import * as React from 'react';
import { useSetState } from '@mantine/hooks';
import { useDebouncedCallback, useSetState } from '@mantine/hooks';
import type { ECElementEvent, ECharts, ComposeOption } from 'echarts/core';
import { use, init } from 'echarts/core';
import { BarChart, LineChart } from 'echarts/charts';
Expand Down Expand Up @@ -85,6 +85,11 @@ export function useChart({
instance: null as ECharts | null,
});

const debouncedResizeObserver = useDebouncedCallback((entries: ResizeObserverEntry[]) => {
const newDimensions = entries[0]?.contentRect;
setState({ width: newDimensions?.width, height: newDimensions?.height });
}, 250);

const mouseEventsRef = React.useRef(mouseEvents);
mouseEventsRef.current = mouseEvents;

Expand Down Expand Up @@ -132,10 +137,7 @@ export function useChart({

const { ref, setRef } = useSetRef<HTMLElement>({
register: (element) => {
const observer = new ResizeObserver((entries) => {
const newDimensions = entries[0]?.contentRect;
setState({ width: newDimensions?.width, height: newDimensions?.height });
});
const observer = new ResizeObserver(debouncedResizeObserver);
// create the instance
const instance = init(element);
// Save the mouse events
Expand Down

0 comments on commit eee23a1

Please sign in to comment.