url:
  formhandler-vegam-1:
    pattern: /$YAMLURL/vegam-1
    handler: FormHandler
    kwargs:
      url: $YAMLPATH/flags.csv
      function: data.groupby('Continent').sum().reset_index()
      formats:
        barchart:
          format: vegam
          spec:
            fromjson:
              - {data: __DATA__}
              - {apply: bar, x: Continent, y: c1}
        linechart:
          format: vegam
          spec:
            fromjson:
              - {data: __DATA__}
              - {apply: line, x: Continent, y: c1}
        horizontalbarchart:
          format: vegam
          spec:
            fromjson:
              - {data: __DATA__}
              - {apply: bar, y: Continent, x: c1}
        scatterplot:
          format: vegam
          spec:
            fromjson:
              - {data: __DATA__}
              - {apply: scatter, x: c1, y: c2}
        coloredscatterplot:
          format: vegam
          spec:
            fromjson:
              - {data: __DATA__}
              - {apply: scatter, x: c1, y: c2, color: Continent, shape: Continent}
        bubbleplot:
          format: vegam
          spec:
            fromjson:
              - {data: __DATA__}
              - {apply: scatter, x: c1, y: c2, color: Continent, size: c3}
      headers:
        Content-Type: application/javascript
    cache:
      expiry: {duration: 3600}
  formhandler-vegam-2:
    pattern: /$YAMLURL/vegam-2
    handler: FormHandler
    kwargs:
      url: $YAMLPATH/flags.csv
      function: data.groupby(['Continent', 'Stripes']).mean().reset_index()
      formats:
        multilinechart:
          format: vegam
          spec:
            fromjson:
              - {data: __DATA__}
              - {apply: line, x: Continent, y: c1, color: Stripes}
        stackbar:
          format: vegam
          spec:
            fromjson:
              - {data: __DATA__}
              - {apply: bar, x: Continent, y: c1, color: Stripes, stack: true}
        normalizedstackbar:
          format: vegam
          spec:
            fromjson:
              - {data: __DATA__}
              - {apply: bar, x: Continent, y: c1, color: Stripes, stack: normalize}
        groupbarchart:
          format: vegam
          spec:
            fromjson:
              - {data: __DATA__}
              - {apply: bar, x: Stripes, y: c1, color: Stripes, column: Continent}
        heatmap:
          format: vegam
          spec:
            fromjson:
              - {data: __DATA__}
              - {apply: heatmap, x: Continent, y: Stripes, color: c1}
        heatmaplabels:
          format: vegam
          spec:
            fromjson:
              - {data: __DATA__}
              - {apply: heatmap, x: Continent, y: Stripes, color: c1}
              - {apply: labels, x: Continent, y: Stripes, text: c1}
              - {apply: style, text_format: .1f, n: -1}
        bubbleheatmap:
          format: vegam
          spec:
            fromjson:
              - {data: __DATA__}
              - {apply: scatter, x: Continent, y: Stripes, color: c1, size: c2}
      headers:
        Content-Type: application/javascript
    cache:
      expiry: {duration: 3600}
  formhandler-vegam-3:
    pattern: /$YAMLURL/vegam-3
    handler: FormHandler
    kwargs:
      url: $YAMLPATH/flags.csv
      formats:
        bintable:
          format: vegam
          spec:
            fromjson:
              - {data: __DATA__}
              - {apply: heatmap, x: c1, y: c8, maxbins: 10}
        scattertrellis:
          format: vegam
          spec:
            width: 20
            fromjson:
              - {data: __DATA__}
              - {apply: scatter, x: c1, y: c8, size: c5, color: Stripes, column: Continent}
      headers:
        Content-Type: application/javascript
    cache:
      expiry: {duration: 3600}
