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

Remove vis and AggConfig docs #26072

Closed
wants to merge 2 commits into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ source code and the existing visualizations provided with it.
* <<development-default-response-handler>>
* <<development-none-response-handler>>
* <<development-custom-response-handler>>
- <<development-vis-object>>
* <<development-vis-timefilter>>
- <<development-aggconfig>>

[[development-visualization-factory]]
=== Visualization Factory
Expand Down Expand Up @@ -406,65 +404,3 @@ const MyNewVisType(Private) => {

VisTypesRegistryProvider.register(MyNewVisType);
-----------

[[development-vis-object]]
=== Vis object
The `vis` object holds the visualization state and is the window into kibana:

- *vis.params*: holds the visualization parameters
- *vis.indexPattern*: selected index pattern object
- *vis.getState()*: gets current visualization state
- *vis.updateState()*: updates current state with values from `vis.params`
- *vis.resetState()*: resets `vis.params` to the values in the current state
- *vis.forceReload()*: forces whole cycle (request handler gets called)
- *vis.getUiState()*: gets UI state of visualization
- *vis.uiStateVal(name, val)*: updates a property in UI state
- *vis.isEditorMode()*: returns true if in editor mode
- *vis.API.timeFilter*: allows you to access time picker
- *vis.API.queryFilter*: gives you access to queryFilter
- *vis.API.events.click*: default click handler
- *vis.API.events.brush*: default brush handler

The visualization gets all its parameters in `vis.params`, which are default values merged with the current state.
If the visualization needs to update the current state, it should update the `vis.params` and call `vis.updateState()`
which will inform <visualize> about the change, which will call request and response handler and then your
visualization's render method.

For the parameters that should not be saved with the visualization you should use the UI state.
These hold viewer-specific state, such as popup open/closed, custom colors applied to the series etc.

You can access filter bar and time picker through the objects defined on `vis.API`

[[development-vis-timefilter]]
==== timeFilter

Update the timefilter time values and call update() method on it to update time picker

["source","js"]
-----------
timefilter.time.from = moment(ranges.xaxis.from);
timefilter.time.to = moment(ranges.xaxis.to);
timefilter.time.mode = 'absolute';
timefilter.update();
-----------


[[development-aggconfig]]
=== AggConfig object

The AggConfig object represents an aggregation search to Elasticsearch,
plus some additional functionality to manage data-values that belong to this aggregation.
This is primarily used internally in Kibana, but you may find you have a need for it
when writing your own visualization. Here we provide short description of some of the methods on it,
however the best reference would be to actually check the source code.


- *fieldFormatter(<type>)* : returns a function which will format your value according to field formatters defined on
the field. The type can be either 'text' or 'html'.
- *makeLabel()* : gets the label for the aggregation
- *isFilterable()* : return true if aggregation is filterable (you can then call createFilter)
- *createFilter(bucketKey)* : creates a filter for specific bucket key
- *getValue(bucket)* : gets value for a specific bucket
- *getField()* : gets the field used for this aggregation
- *getFieldDisplayName()* : gets field display name
- *getAggParams()* : gets the arguments to the aggregation