sapui5程式碼中使用jquey外掛flot畫圖
阿新 • • 發佈:2019-01-01
下載js類庫放到app的js目錄下面
修改檔案manifest.json
"resources": {
"js": [
{
"uri": "js/jquery.flot.js"
},
{
"uri": "js/jquery.flot.stack.js"
},
{
"uri": "js/JUMFlot.min.js"
}
],
"css": [
{
"uri": "css/style.css"
}
]
controller js程式碼中畫圖即可,比如
plotspider: function() {
var d1 = [ [0,10], [1,20], [2,80], [3,70], [4,60] ];
var d2 = [ [0,30], [1,25], [2,50], [3,60], [4 ,95] ];
var d3 = [ [0,50], [1,40], [2,60], [3,95], [4,30] ];
var data = [
{ label: "Pies", color:"green",data: d1,
spider: {show: true, lineWidth: 12} },
{ label: "Apples",color:"orange",data: d2,
spider: {show: true} },
{ label: "Cherries" ,color:"red",data: d3,
spider: {show: true} }
];
var options = {
series:{
editMode: 'v',editable:true,
spider:{
active: true,highlight: {mode: "area"},
legs: {
data: [{label: "SAP"},{label: "Huawei"},{label: "Lenovo"},{label: "三桶油"},{label: "中國電信"}],
legScaleMax: 1, legScaleMin:0.8
},
spiderSize: 0.9
}
},
grid:{
hoverable: true,clickable: true, editable:true,
tickColor: "rgba(0,0,0,0.2)",mode: "spider"
}
};
$.plot($("#flotContainer"), data, options);
},