Skip to content
Draft
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
1 change: 1 addition & 0 deletions packages/sanddance-explorer/src/dialogs/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ function filterSignals(signal: NewSignal) {
case SandDance.constants.SignalNames.ColorReverse:
case SandDance.constants.SignalNames.PointScale:
case SandDance.constants.SignalNames.TreeMapMethod:
case SandDance.constants.SignalNames.ScaleNice:
case SandDance.constants.SignalNames.ZGrounded:
return false;
default:
Expand Down
2 changes: 1 addition & 1 deletion packages/sanddance-specs/src/charts/barchartH.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export default function (specContext: SpecContext): SpecBuilderProps {
});
} else {
const aggProps: AggregateContainerProps = {
niceScale: true,
dock: 'left',
globalAggregateMaxExtentSignal: 'aggMaxExtent',
globalAggregateMaxExtentScaledSignal: 'aggMaxExtentScaled',
Expand Down Expand Up @@ -153,6 +152,7 @@ export default function (specContext: SpecContext): SpecBuilderProps {
specCapabilities: {
countsAndSums: true,
percentage: true,
signals: totalStyle !== 'sum-strip-percent' ? [SignalNames.ScaleNice] : undefined,
roles: [
{
role: 'y',
Expand Down
2 changes: 1 addition & 1 deletion packages/sanddance-specs/src/charts/barchartV.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export default function (specContext: SpecContext): SpecBuilderProps {
});
} else {
const aggProps: AggregateContainerProps = {
niceScale: true,
dock: 'bottom',
globalAggregateMaxExtentSignal: 'aggMaxExtent',
globalAggregateMaxExtentScaledSignal: 'aggMaxExtentScaled',
Expand Down Expand Up @@ -152,6 +151,7 @@ export default function (specContext: SpecContext): SpecBuilderProps {
specCapabilities: {
countsAndSums: true,
percentage: true,
signals: totalStyle !== 'sum-strip-percent' ? [SignalNames.ScaleNice] : undefined,
roles: [
{
role: 'x',
Expand Down
1 change: 0 additions & 1 deletion packages/sanddance-specs/src/charts/strips.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export default function (specContext: SpecContext): SpecBuilderProps {
const globalAggregateMaxExtentSignal = 'globalAggregateMaxExtentSignal';
const props: AggregateContainerProps = {
dock: 'top',
niceScale: false,
globalAggregateMaxExtentScaledSignal,
globalAggregateMaxExtentSignal,
sumBy: specColumns.size,
Expand Down
1 change: 0 additions & 1 deletion packages/sanddance-specs/src/charts/treemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export default function (specContext: SpecContext): SpecBuilderProps {
const globalAggregateMaxExtentSignal = 'globalAggregateMaxExtentSignal';
const props: AggregateContainerProps = {
dock: 'top',
niceScale: false,
globalAggregateMaxExtentScaledSignal,
globalAggregateMaxExtentSignal,
sumBy: specColumns.size,
Expand Down
1 change: 1 addition & 0 deletions packages/sanddance-specs/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const SignalNames = {
TextSize: 'Text_SizeSignal',
TextTitleSize: 'Text_TitleSizeSignal',
TreeMapMethod: 'Chart_TreeMapMethodSignal',
ScaleNice: 'Chart_ScaleNiceSignal',
XBins: 'RoleX_BinsSignal',
YBins: 'RoleY_BinsSignal',
ZHeight: 'RoleZ_HeightSignal',
Expand Down
1 change: 1 addition & 0 deletions packages/sanddance-specs/src/globalScope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface GlobalSignals {
plotOffsetRight: NewSignal;
plotHeightOut: NewSignal;
plotWidthOut: NewSignal;
scaleNice: NewSignal;
}

export interface GlobalScopeProps {
Expand Down
5 changes: 2 additions & 3 deletions packages/sanddance-specs/src/layouts/aggregateContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export interface AggregateContainerProps extends LayoutProps {
sumBy: Column;
globalAggregateMaxExtentSignal: string;
globalAggregateMaxExtentScaledSignal: string;
niceScale: boolean;
showAxes: boolean;
}

Expand Down Expand Up @@ -69,7 +68,7 @@ export class AggregateContainer extends Layout {

public build(): InnerScope {
const { aggregation, names, props } = this;
const { dock, globalScope, groupings, niceScale, parentScope, showAxes } = props;
const { dock, globalScope, groupings, parentScope, showAxes } = props;

addTransforms(globalScope.data,
{
Expand Down Expand Up @@ -137,7 +136,7 @@ export class AggregateContainer extends Layout {
},
0,
],
nice: niceScale,
nice: { signal: globalScope.signals.scaleNice.name },
zero: true,
reverse: dock === 'top',
};
Expand Down
9 changes: 9 additions & 0 deletions packages/sanddance-specs/src/signals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ export function textSignals(context: SpecContext, heightSignal: string) {
step: 0.05,
},
},
{
name: SignalNames.ScaleNice,
value: true,
bind: {
name: specViewOptions.language.scaleNice,
debounce,
input: 'checkbox',
},
},
];
return signals;
}
Expand Down
1 change: 1 addition & 0 deletions packages/sanddance-specs/src/specBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export class SpecBuilder {
plotOffsetRight: { name: SignalNames.PlotOffsetRight, update: '0' },
plotHeightOut: { name: SignalNames.PlotHeightOut, update: SignalNames.PlotHeightIn },
plotWidthOut: { name: SignalNames.PlotWidthOut, update: SignalNames.PlotWidthIn },
scaleNice: { name: SignalNames.ScaleNice },
};
}

Expand Down
5 changes: 5 additions & 0 deletions packages/sanddance-specs/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ export interface SpecLanguage {
*/
treeMapMethod: string;

/**
* Label for nice scale toggle.
*/
scaleNice: string;

/**
* Label for scatterPlot point scale slider.
*/
Expand Down
1 change: 1 addition & 0 deletions packages/sanddance/src/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const defaultViewerOptions: ViewerOptions = {
InnerPaddingSize: 'Inner padding size',
OuterPaddingSize: 'Outer padding size',
treeMapMethod: 'Treemap layout',
scaleNice: 'Nice scale',
facetColumns: 'Facet columns',
facetRows: 'Facet rows',
markOpacitySignal: 'Mark opacity',
Expand Down