someoneLossChart.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <!-- 染损报表 中的 指定供应商 -->
  3. <div id="someoneLossChart" :style="{ width: '100%', height: '600px' }"></div>
  4. </template>
  5. <script>
  6. import * as echarts from 'echarts' //必须有
  7. export default {
  8. name: 'someoneLossChart', // 未筛选供应商,所有供应商染损分析图
  9. data() {
  10. return {}
  11. },
  12. mounted() {
  13. this.initEcharts()
  14. },
  15. methods: {
  16. initEcharts() {
  17. const option = {
  18. title: {
  19. type: 'category',
  20. text: '物料染损分析图(指定供应商)'
  21. },
  22. tooltip: {},
  23. legend: {
  24. data: ['损耗']
  25. },
  26. xAxis: {
  27. data: this.list.oooo
  28. },
  29. yAxis: {
  30. type: 'value',
  31. name: '(%)'
  32. },
  33. series: [
  34. {
  35. name: '损耗',
  36. type: 'line',
  37. smooth: true,
  38. data: [5, 20, 36, 10, 10, 20]
  39. }
  40. ]
  41. }
  42. //深色 ,'dark'
  43. const myChart = echarts.init(document.getElementById('someoneLossChart')) // 图标初始化
  44. myChart.setOption(option) // 渲染页面
  45. //随着屏幕大小调节图表
  46. window.addEventListener('resize', () => {
  47. myChart.resize()
  48. })
  49. }
  50. }
  51. }
  52. </script>
  53. <style lang="less" scoped>
  54. @import '~@assets/less/common.less';
  55. @import '~@assets/less/overwriter.less';
  56. /deep/ .ant-table-thead > tr > th {
  57. text-align: center;
  58. // font-weight: 700;
  59. }
  60. /deep/ .ant-table-tbody {
  61. text-align: center;
  62. }
  63. // /deep/ th.replacecolor {
  64. // background-color: #ccc;
  65. // }
  66. /deep/ .ant-table-footer .ant-table.body {
  67. // overflow: hidden !important;
  68. }
  69. /deep/ .ant-table.ant-table-bordered .ant-table-footer {
  70. border: none;
  71. padding: 0;
  72. }
  73. #myChart {
  74. h6 {
  75. font-size: 16px;
  76. font-weight: 700;
  77. }
  78. }
  79. </style>