diff --git a/pages/score/index.js b/pages/score/index.js index d61d4cb..9516adc 100644 --- a/pages/score/index.js +++ b/pages/score/index.js @@ -1,6 +1,20 @@ // pages/score/index.js import _ from '../../commons/js/commons' +import * as echarts from '../../ecCanvas/components/ec-canvas/echarts'; const app = getApp() +let lineChartData = {}; +function lineChart(canvas, width, height, dpr) { + const chart = echarts.init(canvas, null, { + width: width, + height: height, + devicePixelRatio: dpr // new + }); + console.log('chart,',chart) + canvas.setChart(chart); + let option = lineChartData + chart.setOption(option); + return chart; +} Page({ /** @@ -47,6 +61,10 @@ Page({ setid: '', is_biz: 0, //是否选择门店跳转过来 scoreData: [], + showLineChart: false,//是否显示Line图表 + ecLine: { + onInit: lineChart + } }, /** @@ -67,7 +85,7 @@ Page({ * 生命周期函数--监听页面初次渲染完成 */ onReady() { - + this.getChartsData() }, /** @@ -113,6 +131,72 @@ Page({ }, + getChartsData(){ + lineChartData = { + backgroundColor: "#ffffff", + xAxis: { + show: false + }, + yAxis: { + show: false + }, + radar: { + // shape: 'circle', + splitArea: { + areaStyle: { + color: ['#f6f6f6', '#ffffff'] + } + }, + indicator: [{ + name: '食品', + max: 500 + }, + { + name: '玩具', + max: 500 + }, + { + name: '服饰', + max: 500 + }, + { + name: '绘本', + max: 500 + }, + { + name: '医疗', + max: 500 + } + ] + }, + series: [{ + name: '标题', + type: 'radar', + data: [{ + value: [430, 340, 500, 300, 490], + name: '预算', + areaStyle: { + normal: { + color: 'rgba(0,136,212,0.2)' // 半透明蓝色 + } + }, + lineStyle: { + color: 'rgba(0,136,212,0.8)', // 这里设置线的颜色为红色 + width: 2 // 线的宽度 + } + }] + }] + }; + setTimeout(() => { + // lineChart + this.setData({ + showLineChart:true, + ['ecLine.onInit']:lineChart, + }) + }, 1000); + + }, + scrollToRule() { this.setData({ setid: 'richhtml' diff --git a/pages/score/index.json b/pages/score/index.json index 52885e1..c4db527 100644 --- a/pages/score/index.json +++ b/pages/score/index.json @@ -1,6 +1,7 @@ { "usingComponents": { "van-circle": "/vant/circle/index", - "com-html": "/components/mp-html/index" + "com-html": "/components/mp-html/index", + "ec-canvas": "/ecCanvas/components/ec-canvas/ec-canvas" } } \ No newline at end of file diff --git a/pages/score/index.wxml b/pages/score/index.wxml index de91e7c..b5c7f4a 100644 --- a/pages/score/index.wxml +++ b/pages/score/index.wxml @@ -1,6 +1,6 @@ - + @@ -47,6 +47,10 @@ + + + + @@ -76,5 +80,5 @@ - + \ No newline at end of file