12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <template>
- <view class="content">
- <qiun-data-charts type="line" :chartData="chartData" echartsApp/>
- </view>
- </template>
- <script module="test" lang="renderjs">
- // import * as echarts from '@/plugin/echarts.js';
- import {
- lalaprice
- } from '@/api/wallet.js'
- export default {
- data() {
- return {
- chartData: {
- categories: [],
- series: [
- {
- name: 'Lala走势',
- data: []
- }
- ]
- }
- }
- },
- mounted() {
- this.createChart()
- },
- methods: {
- createChart() {
- lalaprice().then(e => {
- console.log(e.data, "123456")
- // this.chart_data = e.data
-
- let time = e.data.map(item => {
- return item.date
- })
- console.log(time)
-
- this.$set(this.chartData,'categories',time)
-
- let val = e.data.map(item => {
- return +item.lala_price
- })
-
- console.log(val)
- this.$set(this.chartData.series[0],'data',val)
- // option = {
- // xAxis: {
- // type: 'category',
- // data: time
- // },
- // yAxis: {
- // type: 'value'
- // },
- // series: [{
- // data: val,
- // type: 'line'
- // }],
- // grid: {
- // left: '15%',
- // right: '2%'
- // }
- // };
-
- // option && myChart.setOption(option);
- })
-
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .content {
- width: 750rpx;
- height: 500rpx;
- }
- .line-chart {
- height: 500rpx;
- width: 730rpx;
- margin: auto;
- background-color: #eee;
- }
- </style>
|