-
Notifications
You must be signed in to change notification settings - Fork 572
Add user-configurable toggle for 'nice' scale on charts #777
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
fd8c90e
3743380
4ba5494
d008ec2
9e5f0fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,8 @@ | |
| */ | ||
|
|
||
| import { Layout, LayoutBuildProps, LayoutProps } from './layout'; | ||
| import { FieldNames } from '../constants'; | ||
| import { FieldNames, SignalNames } from '../constants'; | ||
| import { debounce } from '../defaults'; | ||
| import { safeFieldName } from '../expr'; | ||
| import { | ||
| AxisScale, | ||
|
|
@@ -20,14 +21,15 @@ import { | |
| } from '../scope'; | ||
| import { testForCollapseSelection } from '../selection'; | ||
| import { Column } from '@msrvida/chart-types'; | ||
| import { JoinAggregateTransform, LinearScale } from 'vega-typings'; | ||
| import { JoinAggregateTransform, LinearScale, SignalRef } from 'vega-typings'; | ||
|
|
||
| export interface AggregateContainerProps extends LayoutProps { | ||
| dock: 'bottom' | 'top' | 'left'; | ||
| sumBy: Column; | ||
| globalAggregateMaxExtentSignal: string; | ||
| globalAggregateMaxExtentScaledSignal: string; | ||
| niceScale: boolean; | ||
| niceScale: boolean | SignalRef; | ||
| niceScaleDisplay?: string; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot - lets not have this niceScaleDisplay passed through here. Implement this as SignalNames.ZProportion does: see specViewOptions.language.zScaleProportion in packages\sanddance-specs\src\signals.ts
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implemented globally in |
||
| showAxes: boolean; | ||
| } | ||
|
|
||
|
|
@@ -69,7 +71,22 @@ 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, niceScale, niceScaleDisplay, parentScope, showAxes } = props; | ||
|
|
||
| // Add the nice scale signal if display name is provided | ||
| if (niceScaleDisplay) { | ||
| addSignals(globalScope.scope, | ||
| { | ||
| name: SignalNames.ScaleNice, | ||
| value: true, | ||
| bind: { | ||
| name: niceScaleDisplay, | ||
| debounce, | ||
| input: 'checkbox', | ||
| }, | ||
| }, | ||
| ); | ||
| } | ||
|
|
||
| addTransforms(globalScope.data, | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot this should be deleted and the nice scale should be added to GlobalScope
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in commit a9c3182. The
niceScaleproperty has been removed fromAggregateContainerPropsand the signal is now accessed fromGlobalScope.signals.scaleNice.