<script>
export default {
  name: 'UiChartXaxis',
  inject: ['UiChart'],
  props: {
    show: {
      type: Boolean,
      default: true
    },
    /**
     * 纬度数据
    */
    data: {
      type: Array
    },
    /**
     * axisLabel配置
    */
    axisLabel: {
      type: Object
    }
  },
  computed: {
    options() {
      return {
        show: this.show,
        type: this.data ? 'category' : 'value',
        data: this.data,
        axisLabel: Object.assign({}, this.axisLabel)
      }
    }
  },
  created() {
    this.UiChart.setOption('xAxis', this.options)
  },
  render() {
    return null
  }
}
</script>
