Home > Mobile >  WxCharts display has access to the backend data unvalid series data
WxCharts display has access to the backend data unvalid series data

Time:09-19

Var jsonObject=new Array ();
Var array=new array ();
JsonObject=res. Data
The console. The log (jsonObject [0]. Cash)
for(var i=0; i<2; I++) {
Array [I]=jsonObject [I] Cash
The console. The log (array [0])

Capturing the console display data has
New wxCharts ({
CanvasId: 'lineCanvas',
Type: 'the line',
DateArray categories: [dateArray [0], [1], dateArray [2], dateArray [3], dateArray [4], dateArray [5], dateArray [6], dateArray [7]],
Series: [{
Name: 'day running water,
Data: [array [1], 315, 222, 345, 337, 264, 328, 234],
Format: function (val) {
Return val. ToFixed (2) + 'yuan'
}

}].

CodePudding user response:

Var data1=array [0]
That the setData ({
JsonObject jsonObject,
Array: an array,
Data1: data1
})
Then the assignment, the resulting value is 0

CodePudding user response:

//pages/DriverData DriverData. Js
Var wxCharts=the require ("../../utils/wxcharts. Js')
Var Openid='
Var Cash='
Var Violation='
Var Hincome='
Var lineDate='
Var dateArray='
Var jsonObject='
Var array='
Var data1='
Page ({

/* *
* the initial data of the page
*/
Data: {
Openid: "'
Cash: 0,
Violation: 0,
Hincome: 0,
LineDate: "'
DateArray: "'
Array: "'
Data1: "'






//ec: {
//the onInit: initChart
//}

},

/* *
* life cycle function - listening page load
*/
OnLoad: function (options) {
Var Openid=options. The Openid
Var that=this
That. The data. The Openid=Openid
var myDate=new Date();
Var date=myDate. GetTime ()
The console. The log (' users openid for ', that the data. The openid)
The console. The log (' for the user's query time, myDate)
Wx. Request ({//search user data by the openid
Url: 'http://localhost:23711/api/Data/GetData',
Data: {
Openid: Openid,
//Cash: ' ',
//Violation: ' ',
//Hincome: "'
},
Method: "POST",
The content-type header: {' ':' application/json '},
Success: the function (res) {
The console. The log (res) data)
//var jsonObject=res. Data
Cash=res. Data. Cash
Hincome=res. Data. Hincome
Violation=res. Data. Violation
//the console. The log (jsonObject [0]. Cash)
//Cash=jsonObject. Cash
//Hincome=jsonObject. Hincome
//Violation=jsonObject. Violation

That the setData ({
Cash: Cash,
Violation: Violation,
Hincome: Hincome
})

},
Fail: function (res) {
The console. The log (' submit fail ');
Wx. ShowModal ({
Title: 'the query fails,
Content: 'no your data in the database,
ShowCancel: false,
CancelText: "'
CancelColor: "'
ConfirmText: 'sure,
ConfirmColor: "'
Success: the function (res) {},
Fail: function (res) {},
Complete: a function (res) {},
})
},
})
/////////diagram//////////
//get the horizontal axis date
Var lineDate=new Date ();//get date today
LineDate. SetDate (lineDate. GetDate () - 7);//for seven days from the date
Var dateArray=[];
Var dateTemp;
Var flag=1;
DateTemp=(lineDate getMonth () + 1) + "-" + lineDate. GetDate ();
for (var i=0; i <=7. I++) {
DateArray [I]=(lineDate getMonth () + 1) + "-" + (lineDate, getDate () + I);

}
//line chart data acquisition
Wx. Request ({//search user data by the openid
Url: 'http://localhost:23711/api/Data/GetCashFlow',
Data: {
Openid: Openid,

},
Method: "POST",
The content-type header: {' ':' application/json '},
Success: the function (res) {
The console. The log (res) data)
Var jsonObject=new Array ();

Var array=new array ();
JsonObject=res. Data
The console. The log (jsonObject [0]. Cash)
for(var i=0; i<2; I++) {
Array [I]=jsonObject [I] Cash
}
The console. The log (array [0])
Var data1=array [0]
The console. The log (data1);
That the setData ({
JsonObject jsonObject,
Array: an array,
Data1: data1

})
The console. The log (that) the data) data1)
},
Fail: function (res) {
The console. The log (' submit fail ');
Wx. ShowModal ({
Title: 'the query fails,
Content: 'no your data in the database,
ShowCancel: false,
CancelText: "'
CancelColor: "'
ConfirmText: 'sure,
ConfirmColor: "'
Success: the function (res) {},
Fail: function (res) {},
Complete: a function (res) {},
})
},
})
Let windowWidth=320;
Try {
Let res=wx. GetSystemInfoSync ();
WindowWidth=res. WindowWidth;
} the catch (e) {
//do something when the get system info failed
}

New wxCharts ({

CanvasId: 'lineCanvas',
Type: 'the line',
DateArray categories: [dateArray [0], [1], dateArray [2], dateArray [3], dateArray [4], dateArray [5], dateArray [6], dateArray [7]],
Series: [{
Name: 'day running water,
Data:
[that data. Data1, 315222, 345, 337, 264, 328]


},
YAxis: {
Title: 'amount (RMB),
Format: function (val) {
Return val. ToFixed (2);
},
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related