<script>
import { unique } from '@huntianning/components/src/utils/string'

export default {
  name: 'UiChartLine',
  inject: ['UiChart'],
  props: {
    data: {
      type: Array
    }
  },
  created() {
    this.id = unique()
    this.UiChart.addSeries({
      id: this.id,
      type: 'line',
      data: this.data
    })
  },
  render() {
    return null
  },
  beforeDestroy() {
    this.UiChart.removeSeries(this.id)
  }
}
</script>
