| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355 |
- <template>
- <div class="chart-wrap">
- <v-chart autoresize :option="option"/>
- </div>
- </template>
- <script>
- export default {
- name: 'SyjhdxqkChart',
- data() {
- return {
- option: {}
- }
- },
- created() {
- this.getOption()
- },
- methods: {
- getOption() {
- const baseWidth = 20
- const offsetWidth = 15
- const triangleHeight = 8
- this.option = {
- backgroundColor: 'rgb(2, 10, 33)',
- color: [],
- grid: {
- containLabel: true,
- left: 20,
- right: 20,
- bottom: 60,
- top: 40
- },
- xAxis: {
- data: ['第一季度', '第二季度', '第三季度', '第四季度'],
- position: 'bottom',
- type: 'category'
- },
- yAxis: {
- axisLabel: {
- color: '#ffffff',
- fontSize: 14
- },
- axisTick: {
- lineStyle: {
- color: '#384267',
- width: 0
- },
- show: true
- },
- splitLine: {
- show: false,
- lineStyle: {
- color: '#384267',
- type: 'dashed'
- }
- },
- axisLine: {
- lineStyle: {
- color: '#ffffff',
- width: 0,
- type: 'dashed'
- },
- show: true
- },
- name: ''
- },
- series: [
- {
- data: [200, 85, 112, 275],
- type: 'pictorialBar',
- symbol: 'rect',
- symbolSize: ['100%', '100%'],
- symbolOffset: [-offsetWidth, 0],
- barMaxWidth: 'auto',
- barWidth: baseWidth,
- itemStyle: {
- color: {
- x: 0,
- y: 0,
- x2: 0,
- y2: 1,
- type: 'linear',
- global: false,
- colorStops: [
- {
- offset: 0,
- color: 'rgb(106, 169, 216)'
- },
- {
- offset: 1,
- color: 'rgb(54, 125, 181)'
- }
- ]
- }
- },
- zlevel: 1
- },
- {
- data: [1, 1, 1, 1],
- type: 'pictorialBar',
- symbol: 'triangle',
- symbolRotate: 180,
- symbolOffset: [-offsetWidth, '96%'],
- symbolSize: ['100%', triangleHeight],
- barMaxWidth: 'auto',
- barWidth: baseWidth,
- itemStyle: {
- color: 'rgb(54, 125, 181)'
- },
- zlevel: 1
- },
- {
- data: [200, 85, 112, 275],
- type: 'pictorialBar',
- symbolPosition: 'end',
- symbol: 'triangle',
- symbolRotate: 180,
- symbolSize: [baseWidth, triangleHeight],
- symbolOffset: [-offsetWidth, '-0%'],
- barMaxWidth: 'auto',
- barWidth: baseWidth,
- itemStyle: {
- color: 'rgb(159, 214, 253)'
- },
- zlevel: 2
- },
- {
- data: [600, 541, 741, 741],
- type: 'pictorialBar',
- symbol: 'rect',
- symbolSize: [baseWidth, '100%'],
- symbolOffset: [-offsetWidth, 0],
- barMaxWidth: 'auto',
- barWidth: baseWidth,
- itemStyle: {
- color: {
- x: 0,
- y: 0,
- x2: 0,
- y2: 1,
- type: 'linear',
- global: false,
- colorStops: [
- {
- offset: 0,
- color: 'rgb(35, 55, 81)'
- },
- {
- offset: 1,
- color: 'rgb(30, 52, 75)'
- }
- ]
- }
- },
- label: {
- show: true,
- distance: 10,
- color: '#fff',
- position: [-baseWidth + 5, -20]
- },
- zlevel: -1
- },
- {
- data: [600, 541, 741, 741],
- type: 'pictorialBar',
- symbolPosition: 'end',
- symbol: 'triangle',
- symbolRotate: 180,
- symbolSize: [baseWidth, triangleHeight],
- symbolOffset: [-offsetWidth, '0%'],
- barMaxWidth: 'auto',
- barWidth: baseWidth,
- itemStyle: {
- color: 'rgb(49, 70, 97)'
- },
- zlevel: 1
- },
- // 2
- {
- data: [160, 410, 112, 275],
- type: 'pictorialBar',
- symbol: 'rect',
- symbolSize: [baseWidth, '100%'],
- symbolOffset: [offsetWidth, '0%'],
- barMaxWidth: 'auto',
- barWidth: baseWidth,
- itemStyle: {
- color: {
- x: 0,
- y: 0,
- x2: 0,
- y2: 1,
- type: 'linear',
- global: false,
- colorStops: [
- {
- offset: 0,
- color: 'rgb(107, 204, 220)'
- },
- {
- offset: 1,
- color: 'rgb(57, 154, 178)'
- }
- ]
- }
- },
- zlevel: 1
- },
- {
- data: [1, 1, 1, 1],
- type: 'pictorialBar',
- symbol: 'triangle',
- symbolRotate: 180,
- symbolSize: [baseWidth, triangleHeight],
- symbolOffset: [offsetWidth, '96%'],
- barMaxWidth: 'auto',
- barWidth: baseWidth,
- itemStyle: {
- color: 'rgb(57, 154, 178)'
- },
- zlevel: 1
- },
- {
- data: [160, 410, 112, 275],
- type: 'pictorialBar',
- symbolPosition: 'end',
- symbol: 'triangle',
- symbolRotate: 180,
- symbolSize: [baseWidth, triangleHeight],
- symbolOffset: [offsetWidth, '0%'],
- barMaxWidth: 'auto',
- barWidth: baseWidth,
- itemStyle: {
- color: 'rgb(159, 214, 253)'
- },
- zlevel: 2
- },
- {
- data: [580, 541, 741, 420],
- type: 'pictorialBar',
- symbol: 'rect',
- symbolSize: [baseWidth, '100%'],
- symbolOffset: [offsetWidth, '0%'],
- barMaxWidth: 'auto',
- barWidth: baseWidth,
- itemStyle: {
- color: {
- x: 0,
- y: 0,
- x2: 0,
- y2: 1,
- type: 'linear',
- global: false,
- colorStops: [
- {
- offset: 0,
- color: 'rgb(33, 59, 72)'
- },
- {
- offset: 1,
- color: 'rgb(30, 64, 78)'
- }
- ]
- }
- },
- label: {
- show: true,
- distance: 10,
- color: '#fff',
- position: [baseWidth - 5, -20]
- },
- zlevel: -1
- },
- {
- data: [580, 541, 741, 420],
- type: 'pictorialBar',
- symbolPosition: 'end',
- symbol: 'triangle',
- symbolRotate: 180,
- symbolSize: [baseWidth, triangleHeight],
- symbolOffset: [offsetWidth, '0%'],
- barMaxWidth: 'auto',
- barWidth: baseWidth,
- itemStyle: {
- color: 'rgb(49, 70, 97)'
- },
- zlevel: 1
- }
- ],
- tooltip: {
- trigger: 'axis',
- show: false
- }
- }
- }
- }
- }
- </script>
- <style scoped lang="scss">
- $xHeight: 120px;
- .chart-wrap {
- width: 100%;
- height: 100%;
- .left-bar {
- width: 35px;
- display: inline-block;
- }
- .right-conent {
- width: calc(100% - 35px);
- height: 100%;
- display: grid;
- grid-template-columns: 1fr 1fr 1fr 1fr;
- grid-template-rows: auto $xHeight;
- }
- }
- </style>
|