# all files / candela/components/Scatter/ index.js

90.2% Statements 46/51
100% Branches 31/31
72.73% Functions 8/11
54.55% Lines 6/11
8 statements, 2 functions, 13 branches Ignored

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    891×
    1×
    1×

    1×

    1×

     import VisComponent from '../../VisComponent';
    import vega from '../../util/vega';
    import spec from './spec.json';

    export default class Scatter extends VisComponent {
      static get spec () {
        return {
          options: [
            {
              name: 'data',
              type: 'table',
              format: 'objectlist'
            },
            {
              name: 'x',
              type: 'string',
              format: 'text',
              domain: {
                mode: 'field',
                from: 'data',
                fieldTypes: ['date', 'number', 'integer', 'boolean']
              }
            },
            {
              name: 'y',
              type: 'string',
              format: 'text',
              domain: {
                mode: 'field',
                from: 'data',
                fieldTypes: ['date', 'number', 'integer', 'boolean']
              }
            },
            {
              name: 'size',
              type: 'string',
              format: 'text',
              domain: {
                mode: 'field',
                from: 'data',
                fieldTypes: ['number', 'integer', 'boolean']
              }
            },
            {
              name: 'shape',
              type: 'string',
              format: 'text',
              domain: {
                mode: 'field',
                from: 'data',
                fieldTypes: ['string', 'date', 'number', 'integer', 'boolean']
              }
            },
            {
              name: 'color',
              type: 'string',
              format: 'text',
              domain: {
                mode: 'field',
                from: 'data',
                fieldTypes: ['string', 'date', 'number', 'integer', 'boolean']
              }
            },
            {
              name: 'hover',
              type: 'string_list',
              format: 'string_list',
              domain: {
                mode: 'field',
                from: 'data',
                fieldTypes: ['string', 'date', 'number', 'integer', 'boolean']
              }
            }
          ]
        };
      }

      constructor (el, options) {
        super(el);
        this.options = options;
        this.render();
      }

      render () {
        vega.parseChart(spec, this.el, this.options);
      }
    }