import { createModel } from "@arcgis/charts-components/model/shared/setup-utils.js";Functions
createModel
- Type parameters
- <T extends ModelTypes>
Creates a new chart model for config interaction based on the provided properties.
Various combinations of properties layer, iLayer, chartType, and config are supported.
- Signature
-
createModel <T extends ModelTypes>(props: CreateModelProps<T>): Promise<ModelOfType<T>>
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| props | The properties used to set up the chart. | |
- Returns
- Promise<ModelOfType>
Example
const chartModel = await createModel({ layer: myLayer, chartType: "gauge",});Type definitions
CreateModelProps
- Type parameters
- <T extends ModelTypes>
Properties used by the createModel function to create a new model.
Various combinations of layer, iLayer, chartType, and config are supported.
LayerAndType
- Type parameters
- <T extends ModelTypes>
Properties used by the createModel function to create a new model based on the provided layer and chartType.
A new model of the specified type will be created using default values.
layer
- Type
- SupportedLayer
ILayerAndType
- Type parameters
- <T extends ModelTypes>
Properties used by the createModel function to create a new model based on the provided iLayer and chartType.
A new model of the specified type will be created using default values.
iLayer
- Type
- IFeatureLayer
LayerAndSourcelessConfig
- Type parameters
- <T extends ModelTypes>
Properties used by the createModel function to create a new model based on the provided iLayer and config.
The config is considered "sourceless" since its iLayer property is not required.
layer
- Type
- SupportedLayer
config
- Type
- ChartConfig
ILayerAndSourcelessConfig
- Type parameters
- <T extends ModelTypes>
Properties used by the createModel function to create a new model based on the provided iLayer and config.
The config is considered "sourceless" since its iLayer property is not required.
iLayer
- Type
- IFeatureLayer
config
- Type
- ChartConfig
SourcedConfig
- Type parameters
- <T extends ModelTypes>
Properties used by the createModel function to create a new model based on the provided config.
Note: The config must have its iLayer property (source) defined.
config
- Type
- ChartConfig