Skip to content

Tools: tree–namespace.json

bre1470 edited this page Sep 23, 2019 · 8 revisions

Tools: tree-namespace.json

This file describes the namespace for Highcharts. It is available under https://api.highcharts.com/highcharts/tree-namespace.json. The tree-namespace.json file is created by JSDoc with the highcharts-documentation-generators/jsdoc/plugins/highcharts.namespace.js plugin and is based on the doclets in the ./code directory.

Content

How To Use It

The tree-namespace.json file is an addition to tree.json and contains all classes, interfaces, and types, which are not part of the options tree itself. Unlike the tree.json file though, the tree-namespace.json file is not generated out of the source files in the js/ folder, but instead out of the combined files in the code/ folder. The core types are based on TypeScript and contain:

  • *, could be any of the other types
  • Array<T> generic Array type, also T[]
  • boolean
  • function
  • null
  • number, also double in other languages
  • object, with unknown properties
  • string
  • undefined, indicates an optional property or parameter
  • "literal", a literal string type, similar to an enum value in other languages

Additionally there are Highcharts types (like Highcharts.Dictionary<T>), globals types (like globals.GlobalSVGElement), and global types (like global.Date). The distinction between globals and global is necessary to access some covered classes inside the Highcharts namespace. For now this is only related to the SVGElement. The Highcharts.SVGElement is a renderer class by Highcharts and the global.SVGElement is the element class by the browser. globals.GlobalSVGElement provides the necessary connection between these both namespaces.

Structure

interface INode {
    doclet: IDoclet;
    children?: Array<INode>;
    meta?: IMeta;
}

interface IDoclet {
    description: string;
    kind: IKind;
    name: string;
    defaultValue?: (boolean | number | string);
    events?: Dictionary<IEvent>;
    fires?: Array<string>;
    isDeprecated?: boolean;
    isGlobal?: boolean;
    isOptional?: boolean;
    isPrivate?: boolean;
    isStatic?: boolean;
    parameters?: Dictionary<IParameter>;
    products?: Array<string>
    return?: IReturn;
    see?: Array<string>;
    types?: ITypes;
    values?: string;
}

interface IMeta {
    files: Array<IFile>;
}

interface IEvent {
    description: string;
    types: ITypes;
}

interface IFile {
    path: string;
    line: number;
}

type IKind = (
    'class' |
    'constructor' |
    'external' |
    'function' |
    'global' |
    'interface' |
    'member' |
    'namespace' | 
    'typedef'
);

interface IParameter {
    defaultValue?: (boolean|number|string);
    description?: string;
    isOptional?: boolean;
    isVariable?: boolean;
    types?: ITypes;
}

interface IReturn {
    description?: string;
    types?: ITypes;
}

type ITypes = Array<string>;