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

Fix typo in timeunit 'weekdayhours' #8021

Closed
wants to merge 7 commits into from
Closed
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
4 changes: 2 additions & 2 deletions build/vega-lite-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -15184,7 +15184,7 @@
"monthdatehoursminutes",
"monthdatehoursminutesseconds",
"weekday",
"weeksdayhours",
"weekdayhours",
"weekdayhoursminutes",
"weekdayhoursminutesseconds",
"dayhours",
Expand Down Expand Up @@ -17346,7 +17346,7 @@
"description": "An object that specifies the format for parsing the data."
},
"name": {
"description": "Provide a placeholder name and bind data at runtime.",
"description": "Provide a placeholder name and bind data at runtime.\n\nNew data may change the layout but Vega does not always resize the chart. To update the layout when the data updates, set [autosize](https://vega.github.io/vega-lite/docs/size.html#autosize) or explicitly use [view.resize](https://vega.github.io/vega/docs/api/view/#view_resize).",
"type": "string"
}
},
Expand Down
Binary file modified examples/compiled/time_parse_utc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/compiled/time_parse_utc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/compiled/time_parse_utc.vg.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"format": {
"signal": "timeUnitSpecifier([\"hours\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"})"
},
"formatType": "time",
"formatType": "utc",
"labelOverlap": true,
"zindex": 0
}
Expand Down
2 changes: 1 addition & 1 deletion site/docs/parameter/parameter.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ For example, try the two types against the example selection (named `pts`) below

<div id="selection_type" class="vl-example" data-name="selection_type_point"></div>

While selection types provide useful defaults, you can set `select` to be a [selection definion](selection.html) to override default selection behaviors abd customize the interaction design. See the [selection](selection.html) documentation for more information about the selection definition.
While selection types provide useful defaults, you can set `select` to be a [selection definion](selection.html) to override default selection behaviors and customize the interaction design. See the [selection](selection.html) documentation for more information about the selection definition.

## Using Parameters

Expand Down
1 change: 1 addition & 0 deletions site/ecosystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ We mark featured plugins and tools with a <span class="octicon octicon-star"></s
- [Vegas](https://github.com/aishfenton/Vegas) brings visualizations to Scala and Spark using Vega-Lite.
- [Smile](https://haifengl.github.io/) is a machine learning engine for JVM using Vega-Lite.
- [vegawidget](https://vegawidget.github.io/vegawidget), low-level interface in R to render Vega and Vega-Lite specifications as htmlwidgets, including functions to interact with data, events, and signals in [Shiny](https://shiny.rstudio.com).
- [vegabrite](https://vegawidget.github.io/vegabrite), functional interface for building up Vega-Lite specifications in R. Built on top of the lower-level interface provided by vegawidget
- [Hanami](https://github.com/jsa-aerial/hanami) A Clojure(Script) library for creating domain specific interactive visualization applications. Exposes a parameterized template system that uses recursive transformation to finished Vega-Lite and Vega specs. Built with [reagent](https://reagent-project.github.io/) (react) and [re-com](https://github.com/Day8/re-com) enabled.
- [Vizard](https://github.com/yieldbot/vizard) tiny REPL client to visualize Clojure data in browser w/ Vega-Lite.
- [Oz](https://github.com/metasoarous/oz) is a Vega & Vega-Lite based visualization and scientific document toolkit for Clojure & ClojureScript (Reagent). Originally a fork of Vizard, Oz adds support for Vega, publishing/sharing, markdown & hiccup extensions for embedding Vega-Lite & Vega visualizations in html documents, static html output, and Jupyter notebooks.
Expand Down
2 changes: 1 addition & 1 deletion src/compile/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export function guideFormatType(
return formatType;
}
if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef) && scaleType !== 'time' && scaleType !== 'utc') {
return 'time';
return isFieldDef(fieldOrDatumDef) && normalizeTimeUnit(fieldOrDatumDef?.timeUnit)?.utc ? 'utc' : 'time';
}
return undefined;
}
Expand Down
2 changes: 2 additions & 0 deletions src/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ export interface InlineData extends DataBase {
export interface NamedData extends DataBase {
/**
* Provide a placeholder name and bind data at runtime.
*
* New data may change the layout but Vega does not always resize the chart. To update the layout when the data updates, set [autosize](https://vega.github.io/vega-lite/docs/size.html#autosize) or explicitly use [view.resize](https://vega.github.io/vega/docs/api/view/#view_resize).
*/
name: string;
}
Expand Down
2 changes: 1 addition & 1 deletion src/timeunit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const LOCAL_MULTI_TIMEUNIT_INDEX = {
monthdatehoursminutesseconds: 1,

weekday: 1,
weeksdayhours: 1,
weekdayhours: 1,
weekdayhoursminutes: 1,
weekdayhoursminutesseconds: 1,

Expand Down
15 changes: 14 additions & 1 deletion test/compile/format.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {vgField} from '../../src/channeldef';
import {formatSignalRef, numberFormat, timeFormatExpression} from '../../src/compile/format';
import {formatSignalRef, guideFormatType, numberFormat, timeFormatExpression} from '../../src/compile/format';
import {defaultConfig} from '../../src/config';
import {NOMINAL, ORDINAL, QUANTITATIVE, TEMPORAL} from '../../src/type';

Expand Down Expand Up @@ -130,4 +130,17 @@ describe('Format', () => {
});
});
});

describe('guideFormatType()', () => {
it('should return existing format type', () => {
expect(guideFormatType('number', {field: ' foo', type: 'quantitative'}, 'ordinal')).toBe('number');
expect(guideFormatType('time', {field: ' foo', type: 'quantitative'}, 'ordinal')).toBe('time');
});

it('should return utc for utc time units', () => {
expect(
guideFormatType('', {field: ' foo', type: 'ordinal', timeUnit: {utc: true, unit: 'year'}}, 'ordinal')
).toBe('utc');
});
});
});