# create method

Information noteSTABLE.   
  
This API is reliable and breaking changes are unlikely.

qlik.app.visualization.create(type, cols, options)

Create a new visualization on the fly based on a session object and will not be persisted in the app.

## Version history

Version history

| Version state | Details |
| --- | --- |
| Introduced | 2.2 |

## Parameters

### type

Type: String

Visualization type. Can be:

* barchart
* boxplot
* combochart
* container
* distributionplot
* gauge
* histogram
* kpi
* linechart
* listbox
* piechart
* pivot-table
* scatterplot
* table
* treemap
* waterfallchart
* extension

The visualization type can be represented by an ID. For example, an extension type can be specified as an extension ID such as "com-qliktech-toolbar".

### cols

Type: Array

Optional.

Column definitions, dimensions and measures. Each entry can be of the following structures:

* String
* NxDimension
* NxMeasure

If the NxDimension or the NxMeasure refer to a library dimension or a library measure, you also need to add qType : "measure" or "dimension".

[Columns](https://help.qlik.com/en-US/sense-developer/November2024/Subsystems/APIs/Content/Sense_ClientAPIs/CapabilityAPIs/VisualizationAPI/columns.htm) for details and examples.

### options

Type: Object

Optional.

Options to set.

[Options](https://help.qlik.com/en-US/sense-developer/November2024/Subsystems/APIs/Content/Sense_ClientAPIs/CapabilityAPIs/VisualizationAPI/options.htm) for all the properties that can be set for each visualization type.

## Returns

A promise of a [QVisualization](https://help.qlik.com/en-US/sense-developer/November2024/Subsystems/APIs/Content/Sense_ClientAPIs/CapabilityAPIs/VisualizationAPI/QVisualization.htm).

## Example

Example: Creating a barchart on the fly

```
var app = qlik.openApp('c31e2aba-3b46-4b13-8b87-c5c2514dea1d', config);
app.visualization.create('barchart',["Case Owner Group","=Avg([Case Duration Time])"],{title:"Great on-the-fly barchart"}).then(function(bar){
	bar.show('QV04');
});
```

Example: Creating a toolbar using an extension.

```
app.visualization.create('com-qliktech-toolbar',null,
	{"buttons":{"clear":true,"back":true,"forward":true}}).then(function(vis){
		vis.show("QV05");
});
```

## Learn more

* [QVisualization](https://help.qlik.com/en-US/sense-developer/November2024/Subsystems/APIs/Content/Sense_ClientAPIs/CapabilityAPIs/VisualizationAPI/QVisualization.htm)