src/Legend.ts

   1/**

   2 * # Legend

   3 * renders the series' legend .

   4 * 

   5 * ### Attributes

   6 * The `Legend` class is called by {@link Graph.Graph `Graph`} as 

   7 * `m(Legend, { cfg:cfg.legend })`

   8 * with the following attributes:

   9 * - cfg: a {@link Legend.LegendConfig LegendConfig} object

  10 * 

  11 * ### Configurations and Defaults

  12 * See {@link Legend.Legend.defaultConfig Legend.defaultConfig}

  13 * 

  14 */

  15

  16/** */

  17export const m = require("mithril");

  18export type Vnode = typeof m.Vnode;

  19import { Config }   from './Graph';

  20//import { SVGElem }  from './SVGElem';

  21

  22

  23/** Defines configurable settings. */ 

  24export interface LegendConfig {

  25};

  26

  27export class Legend {

  28    /** 

  29     * Defines default values for all configurable parameters in `Legend`

  30     * See {@link Graph.Graph.makeConfig Graph.makeConfig} for the sequence of initializations.

  31     * 

  32     * ### Configurations and Defaults

  33     * ```

  34     *  cfg.legend = {@link Legend.LegendConfig }{

  35     *  } 

  36     * ``` 

  37     * @param cfg the configuration object, containing default settings for all 

  38     * previously configured components.

  39     */

  40    static defaultConfig(cfg:Config) {

  41        cfg.legend = {

  42        };

  43    }

  44

  45    /**

  46     * Makes adjustments to cfg based on current settings

  47     * @param cfg the configuration object, containing default settings for all components

  48     */

  49    static adjustConfig(cfg:Config) {

  50        

  51    }

  52    

  53    view(node?: Vnode): Vnode {

  54        return m('svg', { class:'hs-graph-legend', width:'100%', height:'100%'});

  55    }

  56}

  57