Skip to content
Snippets Groups Projects
BarcodePlot.vue 1.46 KiB
Newer Older
HongKee Moon's avatar
HongKee Moon committed
<template>
moon's avatar
moon committed
  <plotly-chart :chart="chartConfig" />
HongKee Moon's avatar
HongKee Moon committed
</template>

<script>
// require modules
/* eslint-disable no-unused-vars */
moon's avatar
moon committed
import plotlyChart from '@/components/PlotlyChart.vue';
HongKee Moon's avatar
HongKee Moon committed
const _ = require('lodash');

export default {
moon's avatar
moon committed
  name: 'BarcodePlot',
HongKee Moon's avatar
HongKee Moon committed
  components: {
    plotlyChart
  },
moon's avatar
moon committed
  props: ['x'],
HongKee Moon's avatar
HongKee Moon committed
  data() {
    return {
      chartConfig: {
moon's avatar
moon committed
        id: 'barcodePlot',
HongKee Moon's avatar
HongKee Moon committed
        traces: [
          {
            //y: ['C','W','Y','F','M','L','I','V','A','G','P','Q','N','T','S','E','D','K','H','R'],
            y: this.x.split(''),
            x: _.range(1, this.x.length + 1),
            // x: this.x,
            mode: 'markers',
            type: 'scatter',
            marker : {
              opacity: 1,
              size: 8,
              symbol: 'line-ns-open'
            }
          }
        ],
        layout: {
          title: 'Barcode Plot',
          xaxis: {
            title: 'Position',
            zeroline: false,
            // range: [0, this.x.length + 1]
          },
          yaxis: {
            autotick: false,
            ticks: 'outside',
            categoryarray: ['C','W','Y','F','M','L','I','V','A','G','P','Q','N','T','S','E','D','K','H','R'],
            tickfont: {
              family: 'Arial, sans-serif',
              size: 12,
              color: 'black'
            },
          }
        }
      }
    }
  },
  mounted() {
    // console.log(this.x.split(''))
  }
}
</script>

<style scoped>
.mainContent {
  padding: 20px;
}
</style>