-
Notifications
You must be signed in to change notification settings - Fork 28
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
feat!: merge axis channels (e.g., x
and xe
); group channels as an encoding
property
#575
Conversation
encoding
property
encoding
propertyencoding
property
encoding
propertyx
and xe
); group channels as a encoding
property
x
and xe
); group channels as a encoding
propertyx
and xe
); group channels as an encoding
property
@@ -2,7 +2,7 @@ export { name, version } from '../package.json'; | |||
import GoslingSchema from '../schema/gosling.schema.json'; | |||
import ThemeSchema from '../schema/theme.schema.json'; | |||
|
|||
export type { GoslingSpec, TemplateTrackDef } from './core/gosling.schema'; | |||
export type { GoslingSpec, Encoding, TemplateTrackDef } from './core/gosling.schema'; |
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.
Would need to ensure to have Encoding
in the schema.json
file.
Reference: #565 (comment)
@@ -15,9 +15,6 @@ export function compile( | |||
// Make sure to keep the original spec as is | |||
const _spec = JSON.parse(JSON.stringify(spec)); | |||
|
|||
// Override default visual encoding (i.e., `DataTrack` => `BasicSingleTrack`) | |||
overrideDataTemplates(_spec); |
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.
Removed this since DataTrack
had been deprecated.
@@ -459,9 +436,11 @@ export interface ChannelDeepCommon { | |||
field?: string; | |||
} | |||
|
|||
export interface X extends ChannelDeepCommon { |
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.
Key changes can be found in this file.
@manzt, sorry that this update was delayed. It turns out to be more significant updates than I expected. Can you review this PR? I would be interested in hearing from you whether the grammatical changes look okay and these updates work for you to continue working on gosling-lang/gos#71. Please review code bases as deeply as you would like to. |
No problem! Won't be able to look today but probably tomorrow. |
@sehilyi I completely lost track of this. Will review this weekend -- sorry! Do you have any thoughts regarding how to reserve these merge conflict? |
@manzt No worries! I was basically thinking of manually resolving conflicts which I hope to be manageable. Also, please let me know if all grammatical changes introduced in this PR make sense to you. Since this PR introduces breaking changes, I would like to merge this carefully. |
@manzt Since this will introduce breaking changes and is too far behind the current version, I am reluctant to resolve conflicts and merge this. I think we can revisit this (at least making an |
Agreed! |
@sehilyi I just wanted to apologize that your hard work here never got a thorough review. I think this PR had several different aims and touched many internals of Gosling that at the time I struggled to understand. |
@manzt No worries. This was such a huge PR. And I am sure we can revisit this and repurpose it for future PRs. |
Fix #506
Fix #482
Summary of Changes
In addition to #533, this PR changes grammar around visual channels.
This PR contains a relatively large amount of changes, but many parts are changes on the examples (
src/example/*.ts
) and tests (*.test.ts
) reflecting the grammatical changes that have been introduced in this PR. This PR introduces the following major grammatical changes.C1. Axis channels are combined
from:
to:
This way, axis channels convey a more clear meaning:
x
andxe
) or the y-axis (i.e.,y
andye
).startField
andendField
in anx
channel).More importantly, this prevents users from making uncertain specs, such as
nominal
field fory
and thenquantitative
field forye
)axis: 'top'
orlinkingId: 'overview'
):C2. The
encoding
property is addedTrack now has a
encoding
property that wraps all channels:This is consistent with the Vega-Lite and is beneficial in gos (gosling-lang/gos#34 (comment)).
C3.
TemplateTrack
modified accordinglyAs we made a grammatical change to channels (i.e.,
x
andxe
-->x: { startField: ...., endField: ..., ...}
), the template mapper logic was changed as well:C4.
DataTrack
is removed entirelyWe did not support
DataTrack
anymore, but it was still included in our code. I removed all related codes. We could support a similar feature with Track Templates in Gosling in the future:To Test Locally
Run the following command to update your local
gosling.schema.json
since this PR updates the grammar.BREAKING CHANGE
This PR introduces breaking changes. To change your existing specification for previous versions (~v0.9.9), you need to change your spec following the instructions described below.
If you are using multiple fields for a single axis in your spec:
You need to combine them to a single axis using up to four fields (i.e.,
startField
,endField
,startField2
,endField2
):Single-field axes are not changed (i.e.,
field
properties are used):Add an
encoding
property to all tracks.From:
To:
TODO
'|xe - x|'
threshold to'assignedWidth'
?