d2c7b04254ac41e92cda366f7f168d9684d39ea7.svn-base 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <div :style="{ padding: '0 0 32px 32px' }">
  3. <h4 :style="{ marginBottom: '20px' }">{{ title }}</h4>
  4. <v-chart
  5. :height="height"
  6. :data="data"
  7. :scale="scale"
  8. :forceFit="true"
  9. :padding="['auto', 'auto', '40', '50']">
  10. <v-tooltip/>
  11. <v-axis/>
  12. <v-bar position="x*y"/>
  13. </v-chart>
  14. </div>
  15. </template>
  16. <script>
  17. export default {
  18. name: 'Bar',
  19. props: {
  20. title: {
  21. type: String,
  22. default: ''
  23. },
  24. x: {
  25. type: String,
  26. default: 'x'
  27. },
  28. y: {
  29. type: String,
  30. default: 'y'
  31. },
  32. data: {
  33. type: Array,
  34. default: () => []
  35. },
  36. height: {
  37. type: Number,
  38. default: 254
  39. }
  40. },
  41. data() {
  42. return {}
  43. },
  44. computed: {
  45. scale() {
  46. return [
  47. { dataKey: 'x', title: this.x, alias: this.x },
  48. { dataKey: 'y', title: this.y, alias: this.y }
  49. ]
  50. }
  51. },
  52. created() {
  53. // this.getMonthBar()
  54. },
  55. methods: {
  56. // getMonthBar() {
  57. // this.$http.get('/analysis/month-bar')
  58. // .then(res => {
  59. // this.data = res.result
  60. // })
  61. // }
  62. }
  63. }
  64. </script>