| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- const app = getApp();
- import * as echarts from '../../../../ec-canvas/echarts' // 这个是自己实际的目录
- Component({
- data:{
- Ec: { lazyLoad: true, },
- },
- lifetimes: {
- attached: function () {
- this.init()
- },
- moved: function () { },
- detached: function () { },
- },
- methods:{
- init(){
- var that = this;
- that.selectComponent('#chartConDom').init((canvas, width, height, dpr) => {
- const chart = echarts.init(canvas, null, {
- width: width,
- height: height,
- devicePixelRatio: dpr
- });
- var option = that.getOrderWarnOption();
- chart.setOption(option);
- return chart;
- });
- },
- getOrderWarnOption(){
- var list = [{name:"生化诊断",value:50,},{name:"免疫诊断",value:30,},{name:"分子诊断",value:30,},{name:"血液检测",value:30,}]
- var fontSize = 10
- var fontColor = "#999999"
- return {
- color:["#333FFF","#FFAE36"],
- title:{
- text:"产品分类信息",
- show:0,
- textStyle:{
- color:fontColor,
- fontSize:fontSize,
- },
- left:'center',
- top:0,
- },
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'cross',
- }
- },
- grid: {
- top: '20%',
- left: '6%',
- right: '4%',
- bottom: '3%',
- containLabel: true
- },
- yAxis: {
- type: 'value',
- axisTick:{show:false,},
- axisLabel:{
- fontSize:fontSize,
- color:fontColor,
- },
- },
- xAxis: {
- type: 'category',
- axisTick:{show:false,},
- axisLabel:{
- fontSize:fontSize,
- color:fontColor,
- },
- axisLine:{
- lineStyle:{
- color:"#cccccc"
- }
- },
- data: list.map(item=>item.name)
- },
- series:[
- {
- type: 'bar',
- barMaxWidth:fontSize*1.5,
- data:list
- },
- ],
- }
- },
- },
- })
|