|
|
@@ -78,7 +78,8 @@ Page({
|
|
|
for (let i = 0; i < records.length; i++) {
|
|
|
let date = records[i].stock_date.split('-');
|
|
|
xdata.push(date[1] + '/' + date[2])
|
|
|
- ydata.push(records[i].today_fund)
|
|
|
+ let y = records[i].total_income.replace('%','')
|
|
|
+ ydata.push(Number(y))
|
|
|
}
|
|
|
xdata = xdata.reverse()
|
|
|
ydata = ydata.reverse()
|
|
|
@@ -109,99 +110,12 @@ Page({
|
|
|
});
|
|
|
|
|
|
|
|
|
-/**折线图 */
|
|
|
-function initChart(canvas, width, height, dpr) {
|
|
|
- wx.getStorage({
|
|
|
- key: 'userInfo',
|
|
|
- success: res => {
|
|
|
- var info = res.data
|
|
|
- wx.request({
|
|
|
- url: host + '/api/wx/index',
|
|
|
- header: {
|
|
|
- 'Authorization': info.token
|
|
|
- },
|
|
|
- success: res => {
|
|
|
- var records = res.data.data.records, xdata=[],ydata=[];
|
|
|
- for (let i = 0; i < records.length; i++) {
|
|
|
- let date = records[i].stock_date.split('-');
|
|
|
- xdata.push(date[1] + '/' + date[2])
|
|
|
- ydata.push(records[i].today_fund+'%')
|
|
|
- }
|
|
|
- xdata = xdata.reverse()
|
|
|
- ydata=ydata.reverse()
|
|
|
- console.log(ydata)
|
|
|
- const chart = echarts.init(canvas, null, {
|
|
|
- width: width,
|
|
|
- height: height,
|
|
|
- devicePixelRatio: dpr // new
|
|
|
- });
|
|
|
- canvas.setChart(chart);
|
|
|
- var option = {
|
|
|
- legend: {
|
|
|
- show: false
|
|
|
- },
|
|
|
- grid: {
|
|
|
- x: 35,
|
|
|
- y: 40,
|
|
|
- x2: 10,
|
|
|
- y2: 35
|
|
|
- },
|
|
|
- tooltip: {
|
|
|
- show: true,
|
|
|
- trigger: 'axis'
|
|
|
- },
|
|
|
- xAxis: {
|
|
|
- type: 'category',
|
|
|
- data: xdata,
|
|
|
- axisLabel: {
|
|
|
- interval: 0,
|
|
|
- rotate: 40,
|
|
|
- color: '#999999'
|
|
|
- }
|
|
|
- },
|
|
|
- yAxis: {
|
|
|
- axisLine: {
|
|
|
- show: true
|
|
|
- },
|
|
|
- type: 'value',
|
|
|
- name: '收益曲线',
|
|
|
- },
|
|
|
- series: [{
|
|
|
- name: 'A',
|
|
|
- type: 'line',
|
|
|
- smooth: true,
|
|
|
- symbolSize: 8,
|
|
|
- lineStyle: {
|
|
|
- color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
|
|
|
- offset: 0,
|
|
|
- color: '#FF2D68'
|
|
|
- }, {
|
|
|
- offset: 1,
|
|
|
- color: '#4C4BFF'
|
|
|
- }]),
|
|
|
- },
|
|
|
- itemStyle: {
|
|
|
- borderWidth: 5,
|
|
|
- borderColor: '#FFAD52',
|
|
|
- color: '#FFAD52'
|
|
|
- },
|
|
|
- data: ydata
|
|
|
- }]
|
|
|
- };
|
|
|
|
|
|
- chart.setOption(option);
|
|
|
- return chart;
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- })
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
|
|
|
|
|
|
|
|
|
function setOption(chart, xdata, ydata) {
|
|
|
+ console.log(ydata)
|
|
|
var option = {
|
|
|
legend: {
|
|
|
show: false
|
|
|
@@ -247,13 +161,14 @@ function setOption(chart, xdata, ydata) {
|
|
|
smooth: true,
|
|
|
symbolSize: 8,
|
|
|
lineStyle: {
|
|
|
- color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
|
|
|
- offset: 0,
|
|
|
- color: '#FF2D68'
|
|
|
- }, {
|
|
|
- offset: 1,
|
|
|
- color: '#4C4BFF'
|
|
|
- }]),
|
|
|
+ color:'#FF2D68'
|
|
|
+ // color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
|
|
|
+ // offset: 0,
|
|
|
+ // color: '#FF2D68'
|
|
|
+ // }, {
|
|
|
+ // offset: 1,
|
|
|
+ // color: '#4C4BFF'
|
|
|
+ // }]),
|
|
|
},
|
|
|
itemStyle: {
|
|
|
borderWidth: 5,
|