определение диаграммы vega-lite с использованием Gramex FormHandler и динамических URL-параметров - PullRequest
0 голосов
/ 28 мая 2019
...
    handler: FormHandler
    kwargs:
      url: $data_file
      default:
        _format: custom
        _chtype: point
        _xcol: sindpop
        _ycol: fsize
        _cate: cid
        _xcoltype: quantitative
        _ycoltype: quantitative
      formats:
        coloredscatterplot:
          format: vega-lite
          spec:
            "$schema": "https://vega.github.io/schema/vega-lite/v2.json"
            width: 380
            height: 400
            autosize:
              type: fit
              contains: padding
            mark: point
            encoding:
              y: {field: fsize, type: quantitative}
              x: {field: sindpop, type: quantitative}
              color: {field: cid, type: nominal}
        custom:
          format: vega-lite
          spec:
            "$schema": "https://vega.github.io/schema/vega-lite/v2.json"
            autosize:
              type: fit
              contains: padding
            width: 400
            height: 380
            mark: '{chtype}'
            encoding:
              x: {field: '{xcol}', type: '{xcoltype}'}
              y: {field: '{ycol}', type: '{ycoltype}'}
              color: {field: '{cate}', type: nominal}

возможно ли использовать URL-параметры, такие как _xcol, _ycol, для динамического создания диаграмм vega-lite, определенных со ссылкой на {{xcol} '&' {ycol} 'и т. Д. ,.?

В приведенном выше фрагменте _format=coloredscatterplot отображается нормально, но _format=custom показывает ошибку: TypeError: Cannot read property 'orient' of undefined.Невозможно отследить ошибку в консоли PY / JS.Это похоже на Issue-99

...