liujiangyong
1 year ago
6 changed files with 0 additions and 89 deletions
@ -1,64 +0,0 @@ |
|||
import * as echarts from '../components/ec-canvas/echarts'; |
|||
|
|||
const app = getApp(); |
|||
|
|||
function initChart(canvas, width, height, dpr) { |
|||
const chart = echarts.init(canvas, null, { |
|||
width: 300, |
|||
height: 300, |
|||
devicePixelRatio: dpr // new
|
|||
}); |
|||
canvas.setChart(chart); |
|||
|
|||
var option = { |
|||
backgroundColor: "#ffffff", |
|||
series: [{ |
|||
label: { |
|||
normal: { |
|||
fontSize: 14 |
|||
} |
|||
}, |
|||
type: 'pie', |
|||
center: ['50%', '50%'], |
|||
radius: ['20%', '40%'], |
|||
data: [{ |
|||
value: 55, |
|||
name: '北京' |
|||
}, { |
|||
value: 20, |
|||
name: '武汉' |
|||
}, { |
|||
value: 10, |
|||
name: '杭州' |
|||
}, { |
|||
value: 20, |
|||
name: '广州' |
|||
}, { |
|||
value: 38, |
|||
name: '上海' |
|||
}] |
|||
}] |
|||
}; |
|||
|
|||
chart.setOption(option); |
|||
return chart; |
|||
} |
|||
|
|||
Page({ |
|||
onShareAppMessage: function (res) { |
|||
return { |
|||
title: 'ECharts 可以在微信小程序中使用啦!', |
|||
path: '/pages/index/index', |
|||
success: function () { }, |
|||
fail: function () { } |
|||
} |
|||
}, |
|||
data: { |
|||
ec: { |
|||
onInit: initChart |
|||
} |
|||
}, |
|||
|
|||
onReady() { |
|||
} |
|||
}); |
@ -1,5 +0,0 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"ec-canvas": "../components/ec-canvas/ec-canvas" |
|||
} |
|||
} |
@ -1,4 +0,0 @@ |
|||
<!--index.wxml--> |
|||
<view class="pie"> |
|||
<ec-canvas id="mychart-dom-pie" canvas-id="mychart-pie" ec="{{ ec }}"></ec-canvas> |
|||
</view> |
@ -1,5 +0,0 @@ |
|||
/**index.wxss**/ |
|||
.pie { |
|||
width: 300px; |
|||
height: 300px; |
|||
} |
Loading…
Reference in new issue