mainline-mini-chart.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <view class="chart-container">
  3. <view class="chart-name">
  4. <view class="t-icon t-icon-xtubiao-4"></view>
  5. <text class="chart-name-text">学期成绩走势</text>
  6. </view>
  7. <view class="charts-box">
  8. <qiun-data-charts class="chart" :canvas2d='true' canvasId='canvans5' type="mainline" :chartData="chartData" :loadingType="4"/>
  9. </view>
  10. </view>
  11. </template>
  12. <script>
  13. export default {
  14. name:"mainline-mini-chart",
  15. props: {},
  16. data() {
  17. return {
  18. chartData: {},
  19. queryObj: {}
  20. };
  21. },
  22. methods:{
  23. getChartData(){
  24. this.chartData = {
  25. categories: [
  26. "开学考试",
  27. "第一月考",
  28. "第二月考",
  29. "期中考试",
  30. "第三月考",
  31. "期末考试"
  32. ],
  33. series: [{
  34. "name": "总成绩",
  35. "data": [
  36. 555,
  37. 577,
  38. 540,
  39. 588,
  40. 563,
  41. 594
  42. ]
  43. }],
  44. }
  45. }
  46. },
  47. //创建组件生命周期函数
  48. created(){
  49. this.getChartData()
  50. }
  51. }
  52. </script>
  53. <style lang="scss">
  54. .chart-container {
  55. border-radius: 20rpx;
  56. display: flex;
  57. align-items: center;
  58. justify-content: center;
  59. flex-direction: column;
  60. background-color: #FFFFFF;
  61. box-shadow: 0 4rpx 8rpx rgba(0,0,0,0.05);
  62. width: 706rpx;
  63. .chart-name {
  64. display: flex;
  65. align-items: center;
  66. justify-content: flex-start;
  67. width: 100%;
  68. margin: 20rpx 0 20rpx 40rpx;
  69. .chart-name-text {
  70. margin-left: 20rpx;
  71. font-size: 30rpx;
  72. font-weight: bold;
  73. color: #3B4144;
  74. }
  75. }
  76. .charts-box{
  77. width: 100%;
  78. height:300rpx;
  79. }
  80. }
  81. .t-icon{
  82. width: 40rpx;
  83. height: 40rpx;
  84. }
  85. </style>