UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

122 lines (114 loc) 5.27 kB
/** * Object containing helper methods for getting optimal color schemes used * to create [pie chart visualizations](https://developers.arcgis.com/javascript/latest/references/core/smartMapping/renderers/pieChart/). * The [getSchemes()](https://developers.arcgis.com/javascript/latest/references/core/smartMapping/symbology/pieChart/#getSchemes) returns color schemes best suited to the given basemap for this visualization style. * * @since 4.24 */ import type Basemap from "../../Basemap.js"; import type { PieChartScheme, PieChartSchemes, BasemapTheme, Theme } from "./types.js"; /** * Returns metadata for the available themes. If a basemap is provided, returns themes that work best * with the given basemap. * * @param basemap - The [Esri basemap string](https://developers.arcgis.com/javascript/latest/references/core/Map/#basemap) * or object that will be used with the returned theme(s). * @returns Returns an object containing information about the available themes for the given basemap. */ export function getThemes(basemap?: Basemap | string): Theme[]; /** * Returns a primary scheme and secondary schemes defining properties for pie chart visualizations. * The `basemap` parameter determines the colors * used to visualize each pie slice. * * @param params - The function parameters. * @returns Returns an object containing * the optimal pie chart scheme to use for the given basemap; it also contains secondary schemes. * @example * // gets the primary scheme for the features of the given geometry type and basemap * const { primaryScheme, secondarySchemes } = pieChartSchemes.getSchemes({ * basemap: map.basemap, * geometryType: featureLayer.geometryType * }); * * // primaryScheme is the suggested default scheme for the layer and basemap */ export function getSchemes(params: GetSchemesParameters): PieChartSchemes | null | undefined; /** * Returns a pie chart scheme with the given name. * * @param params - The function parameters. * @returns Returns the pie chart scheme * with the given name. * @example * // Returns the Flower Field scheme * let flowerFieldScheme = pieChartSchemes.getSchemeByName({ * name: "Flower Field", * basemap: map.basemap, * geometryType: featureLayer.geometryType * }); */ export function getSchemeByName(params: GetSchemesByNameParameters): PieChartScheme | null | undefined; /** * Returns an array of pie chart schemes with the provided tags. These schemes define properties for * pie charts in any layer that can be rendered with a [PieChartRenderer](https://developers.arcgis.com/javascript/latest/references/core/renderers/PieChartRenderer/). * * @param params - The function parameters. * @returns Returns an array of pie chart schemes * either including or excluding the provided tags. * @example * let schemes = pieChartSchemes.getSchemesByTag({ * includedTags: [ "types", "reds" ], * basemap: map.basemap, * geometryType: featureLayer.geometryType * }); */ export function getSchemesByTag(params: GetSchemesByTagParameters): PieChartScheme[]; /** * Clones a pie chart scheme object. * * @param scheme - The pie chart scheme object to clone. * @returns Returns a clone of the given pie chart scheme object. * @example * // clones the primary scheme returned from the getSchemes() method * const pieChartScheme = primaryScheme.clone(); */ export function cloneScheme(scheme: PieChartScheme | null | undefined): PieChartScheme | null | undefined; export interface GetSchemesParameters { /** The geometry type of the features to visualize. */ geometryType: "point" | "polygon"; /** The number of unique values to include in the pie chart visualization. */ numColors: number; /** * The Esri basemap to pair with the visualization. This * value indicates the best color schemes for visualizing charts against the given basemap. If you have a * non-Esri basemap (e.g. a VectorTileLayer basemap with a custom style) or no basemap at all, then use the `basemapTheme` parameter instead. */ basemap?: Basemap | string | null; /** * If you have a * non-Esri basemap (e.g. a VectorTileLayer basemap with a custom style) or no basemap at all, use this parameter to indicate * whether the background of the visualization is `light` or `dark`. */ basemapTheme?: BasemapTheme | null; } export interface GetSchemesByNameParameters extends GetSchemesParameters { /** The name of the scheme to retrieve. */ name: string; } export interface GetSchemesByTagParameters extends GetSchemesParameters { /** * When provided, only schemes containing all the matching tags will be returned. * * **Known Tags:** light | dark | reds | yellows | oranges | greens | blues | purples | pinks | browns | grays | * bright | subdued | deuteranopia | protanopia | tritanopia | grayscale | types | dot-density */ includedTags?: string[] | null; /** * When provided, only schemes missing all the provided tags will be returned. * * **Known Tags:** light | dark | reds | yellows | oranges | greens | blues | purples | pinks | browns | grays | * bright | subdued | deuteranopia | protanopia | tritanopia | grayscale | types | dot-density */ excludedTags?: string[] | null; }