<template>
  <div class="beta-gamma-analysis">
    <div class="beta-gamma-spectrum-sample">
      <beta-gamma-chart-container>
        <template slot="title">
          Beta-Gamma Spectrum: Sample
        </template>
        <beta-gamma-spectrum-chart ref="scatterChartRef" />
      </beta-gamma-chart-container>
    </div>
    <div class="beta-and-gamma-spectrum">
      <div class="spectrum-charts">
        <div class="gamma-spectrum">
          <div class="gamma-spectrum-item">
            <beta-gamma-chart-container>
              <template slot="title">
                Gamma Spectrum: Original
              </template>
              <spectrum-line-chart ref="lineChart1Ref" />
            </beta-gamma-chart-container>
          </div>
          <div class="gamma-spectrum-item">
            <beta-gamma-chart-container>
              <template slot="title">
                Gamma Spectrum: Projected
              </template>
              <spectrum-line-chart ref="lineChart2Ref" />
            </beta-gamma-chart-container>
          </div>
        </div>
        <div class="gamma-spectrum">
          <div class="gamma-spectrum-item">
            <beta-gamma-chart-container>
              <template slot="title">
                Beta Spectrum: Original
              </template>
              <spectrum-line-chart ref="lineChart3Ref" title="Beta" color="#00ff1e" />
            </beta-gamma-chart-container>
          </div>
          <div class="gamma-spectrum-item">
            <beta-gamma-chart-container>
              <template slot="title">
                Beta Spectrum: Projected
              </template>
              <spectrum-line-chart ref="lineChart4Ref" title="Beta" color="#00ff1e" />
            </beta-gamma-chart-container>
          </div>
        </div>
      </div>
      <div class="result-display">
        <beta-gamma-chart-container>
          <template slot="title">
            Result display
          </template>
          <result-display :data="resultDisplay"></result-display>
        </beta-gamma-chart-container>
      </div>
    </div>
  </div>
</template>

<script>
import BetaGammaChartContainer from './components/BetaGammaChartContainer.vue'
import BetaGammaSpectrumChart from './components/BetaGammaSpectrumChart.vue'
import ResultDisplay from './components/ResultDisplay.vue'
import SpectrumLineChart from './components/SpectrumLineChart.vue'
export default {
  components: { BetaGammaChartContainer, SpectrumLineChart, ResultDisplay, BetaGammaSpectrumChart },
  data() {
    return {
      resultDisplay: [
        {
          id: 1,
          isotope: 'Xe131m',
          concentration: '0.03464',
          uncertainty: '+/-0.01988',
          mdc: '0.03464'
        },
        {
          id: 2,
          isotope: 'Xe131m',
          concentration: '0.03464',
          uncertainty: '+/-0.01988',
          mdc: '0.03464'
        },
        {
          id: 3,
          isotope: 'Xe131m',
          concentration: '0.03464',
          uncertainty: '+/-0.01988',
          mdc: '0.03464'
        },
        {
          id: 4,
          isotope: 'Xe131m',
          concentration: '0.03464',
          uncertainty: '+/-0.01988',
          mdc: '0.03464'
        }
      ]
    }
  },
  methods: {
    resize() {
      this.$refs.scatterChartRef && this.$refs.scatterChartRef.resize()
      this.$refs.lineChart1Ref && this.$refs.lineChart1Ref.resize()
      this.$refs.lineChart2Ref && this.$refs.lineChart2Ref.resize()
      this.$refs.lineChart3Ref && this.$refs.lineChart3Ref.resize()
      this.$refs.lineChart4Ref && this.$refs.lineChart4Ref.resize()
    }
  }
}
</script>

<style lang="less" scoped>
.beta-gamma-analysis {
  height: 100%;
  display: flex;
  overflow: auto hidden;

  .beta-gamma-spectrum-sample {
    width: calc(100% - 1078px);
  }

  .beta-and-gamma-spectrum {
    width: 1048px;
    margin-left: 30px;
    flex-direction: column;

    .spectrum-charts {
      display: flex;
      flex-direction: column;
      height: calc(100% - 208px);

      .gamma-spectrum {
        display: flex;
        height: 50%;

        &-item {
          flex: 509px;

          &:first-child {
            margin-right: 30px;
          }
        }
      }
    }

    .result-display {
      flex-shrink: 0;
    }
  }
}
</style>
