ProductionSituation.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template>
  2. <div class="screen-common-component">
  3. <ScreenComHeader :module-id="moduleId" title="产品生产情况" />
  4. <div ref="chartRef" class="charts-container"></div>
  5. </div>
  6. </template>
  7. <script lang="ts" setup>
  8. import ScreenComHeader from "@/views/screens/configs/screenComHeader.vue";
  9. import * as echarts from "echarts";
  10. import { chartLegend } from "@/views/screens/configs/chartsConfig";
  11. const chartRef = ref(null);
  12. const option = {
  13. legend: chartLegend,
  14. tooltip: {},
  15. dataset: {
  16. dimensions: ["product", "2015", "2016", "2017"],
  17. source: [
  18. { product: "Matcha Latte", 2015: 43.3, 2016: 85.8, 2017: 93.7 },
  19. { product: "Milk Tea", 2015: 83.1, 2016: 73.4, 2017: 55.1 },
  20. { product: "Cheese Cocoa", 2015: 86.4, 2016: 65.2, 2017: 82.5 },
  21. { product: "Walnut Brownie", 2015: 72.4, 2016: 53.9, 2017: 39.1 },
  22. ],
  23. },
  24. xAxis: { type: "category" },
  25. yAxis: {
  26. // axisLine: { show: false },
  27. // axisTick: { show: false },
  28. splitLine: { show: false },
  29. },
  30. // Declare several bar series, each will be mapped
  31. // to a column of dataset.source by default.
  32. series: [{ type: "bar" }, { type: "bar" }, { type: "bar" }],
  33. };
  34. onMounted(() => {
  35. const chart = echarts.init(chartRef.value);
  36. chart.setOption(option);
  37. });
  38. const props = defineProps({
  39. moduleId: {
  40. type: String,
  41. required: true,
  42. },
  43. });
  44. </script>
  45. <style lang="scss" scoped></style>