summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/analytics/product_analytics/components/activity_chart.vue
blob: a475ff8fd253f97abc1512a1203bc03c292c6219 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<script>
import { GlColumnChart } from '@gitlab/ui/dist/charts';
import { s__ } from '~/locale';

export default {
  i18n: {
    noDataMsg: s__(
      'ProductAnalytics|There is no data for this type of chart currently. Please see the Setup tab if you have not configured the product analytics tool already.',
    ),
  },
  components: {
    GlColumnChart,
  },
  inject: {
    formattedData: {
      default: {},
    },
  },
  computed: {
    seriesData() {
      return {
        full: this.formattedData.keys.map((val, idx) => [val, this.formattedData.values[idx]]),
      };
    },
  },
};
</script>

<template>
  <div class="gl-xs-w-full">
    <gl-column-chart
      v-if="formattedData.keys"
      :data="seriesData"
      :x-axis-title="__('Value')"
      :y-axis-title="__('Number of events')"
      :x-axis-type="'category'"
    />
    <p v-else data-testid="noActivityChartData">
      {{ $options.i18n.noDataMsg }}
    </p>
  </div>
</template>