UNPKG

@amcharts/amcharts5

Version:
74 lines 2.66 kB
import type { Root } from "../../core/Root"; import { Entity } from "../../core/util/Entity"; import { Container } from "../../core/render/Container"; export declare class MissingRefError extends Error { refName: string; constructor(refName: string); } export interface IParseSettings { /** * Parent container to place the parsed chart into. */ parent?: Container; /** * If set to `"strict"` and source object has `type` set, a new object of * that type will be created and used in place of existing one. * * In case of `"soft"`, parser will check if source and target objects are * of the same type and overwrite only if types differ. Otherwise only * settings will be applied, just like if the `type` was not specified at all. * * @default "strict" * @since 5.20.3 */ updateTargets?: "strict" | "soft"; } /** * A parser for JSON based chart configs. * * @see {@link https://www.amcharts.com/docs/v5/concepts/serializing/} for more info * @since 5.3.0 */ export declare class JsonParser { protected _root: Root; /** * IMPORTANT! Do not instantiate this class via `new Class()` syntax. * * Use static method `Class.new()` instead. * * @see {@link https://www.amcharts.com/docs/v5/getting-started/#New_element_syntax} for more info * @ignore */ constructor(root: Root, isReal: boolean); /** * Use this method to create an instance of this class. * * @see {@link https://www.amcharts.com/docs/v5/getting-started/#New_element_syntax} for more info * @param root Root element * @return Instantiated object */ static new<C extends typeof JsonParser, T extends InstanceType<C>>(this: C, root: Root): T; /** * Parses and creates chart objects from simple objects. * * @param object Serialized data * @return A promise of a target object */ parse<E extends Entity>(object: unknown, settings?: IParseSettings): Promise<E>; /** * Parses and creates chart objects from JSON string. * * @param string JSON string * @return A promise of a target object */ parseString<E extends Entity>(string: string, settings?: IParseSettings): Promise<E>; } /** * Registers a class so that it can be parsed and instantiated bey JSON parser. * * @param name Class name * @param func Class reference * @ignore */ export declare function registerCustomClass(name: string, ref: any): void; //# sourceMappingURL=Json.d.ts.map