<template>
  <ChartView
    v-if="config.type === 'chart'"
    :data="[...data].reverse()"
    :xaxis="config.x"
    :yaxis="config.y"
  />
  <TableView
    v-else
    :items="data"
    :columns="config.columns"
  />
</template>

<script>
import ChartView from './ChartView.vue';
import TableView from './TableView.vue';

export default {
  components: { ChartView, TableView },
  props:      {
    config: {
      type:     Object,
      required: true
    },
    data: {
      type:     Array,
      required: true
    }
  }
};
</script>

<style>

</style>
