Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/vegaPublic

Commitd84a88b

Browse files
committed
Document View API data method change.
1 parent67ccd54 commitd84a88b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

‎docs/docs/api/view.md‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,10 +401,18 @@ Returns the [scale](https://github.com/vega/vega/blob/master/packages/vega-scale
401401
[projection](https://github.com/vega/vega/blob/master/packages/vega-projection/) instance with the given*name*. The return value is a*live* instance used by the underlying dataflow. Callers should take care not to modify the returned instance!
402402

403403
<aname="view_data"href="#view_data">#</a>
404-
view.<b>data</b>(<i>name</i>)
404+
view.<b>data</b>(<i>name</i>[, <i>values</i>])
405405
[<>](https://github.com/vega/vega/blob/master/packages/vega-view/src/data.js"Source")
406406

407-
Returns the data set with the given*name*. The returned array of data objects is a*live* array used by the underlying dataflow. Callers that wish to modify the returned array should first make a defensive copy, for example using`view.data('name').slice()`.
407+
If only one argument is provided, returns the data set with the given*name*. The returned array of data objects is a*live* array used by the underlying dataflow. Callers that wish to modify the returned array should first make a defensive copy, for example using`view.data('name').slice()`.
408+
409+
If two arguments are provided, removes the current data and inserts the provied input*values*, which can be either a single data object or an array of data objects. This call is equivalent to:
410+
411+
```js
412+
view.change(vega.changeset().remove(vega.truthy).insert(values));
413+
```
414+
415+
Data updates do not force an immediate update to the view: invoke the[runAsync](#view_runAsync) method when ready. Note also that a single argument (getter) call returns the*output* of the data transform pipeline, whereas the two argument (setter) call sets the*input* to the transform pipeline.
408416

409417
<aname="view_addDataListener"href="#view_addDataListener">#</a>
410418
view.<b>addDataListener</b>(<i>name</i>, <i>handler</i>)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp