|
¥�� |
������ 3 ��ǰ
|
���դ������ը�һ�������echart��
- (function(){
- var xdataarr = [];
- var ydataarr1 = []; //�ܿͻ���
- var ydataarr2 = []; //�ݷ�����
- var country = getitemvalueasstring("��");
- var m = getitemvalueasstring("�·�");
- var year = getyear(gettoday());
- var ym = year "-" m;
- var countrydefault = "where k.item_������ in ( '321302','321311','341323','321322','341324','341302') "; //һֱ��ĭ�ϵ��ر���
- if (country != "") {
- countrydefault = ",(select domainid, item_��, item_���� from obpm_oa.tlk_�м�) c "
- "where "
- "c.`item_����`='" country "' and c.item_���� = x.item_�ϼ� ";
- }
- var sql =
- "select x.`item_��`, (select count(item_�ͻ�����) from obpm_oa.tlk_�ͻ� where item_������=x.item_����) as �ܿͻ���, count(distinct v.`item_�ͻ�����`) as �ݷ��� "
- "from "
- "(select domainid, item_��, item_����, item_�ϼ� from obpm_oa.tlk_�ؼ�) x, "
- "obpm_oa.tlk_�ͻ� k,"
- "(select domainid, `item_�ͻ�����`, `item_��ϵʱ��` from obpm_oa.tlk_�ݷ���ϵ��¼ where `item_�ݷ���ϵ��ʽ`='����' and `item_�ͻ�����`!='' "
- "and `item_��ϵʱ��` between '" ym "-1' and '" ym "-31 23:59:59') v " countrydefault
- "and x.item_���� = k.item_������ "
- "and k.`item_�ͻ�����` = v.`item_�ͻ�����` "
- "group by x.`item_��`";
- var query = querybydsname("oa", sql);
- if (query.size() > 0) {
- for (var it = query.iterator(); it.hasnext();) {
- var its = it.next();
- var country = its.get("item_��");
- var sumnum = its.get("�ܿͻ���");
- var num = its.get("�ݷ���");
- xdataarr.push(new string(country));
- ydataarr1.push(new string(sumnum));
- ydataarr2.push(new string(num));
- }
- }
- var ydataarr3 = []; //δ�ݷ���
- for (var i = 0; i < ydataarr1.length; i ) {
- ydataarr3[i] = ydataarr1[i] - ydataarr2[i];
- }
- var option = {
- title: {
- text: '�г��ͻ��ݷ�ռ����',
- right: 'center',
- top: '5%',
- textstyle: {
- fontsize: 20
- }
- },
- toolbox: {
- feature: { //���е�
- saveasimage: {}, //����ͼƭ
- dataview: {}, //������ͼ
- restore: {}, //����
- datazoom: {}, //��������
- magictype: { //��̬�����л�
- type: ['bar', 'line']
- }
- },
- orient: 'vertical',
- right: '15%',
- top: '10%'
- },
- grid: {
- left: '20%',
- right: '30%',
- bottom: '45%',
- top: '15%',
- width: '60%',
- height: '50%'
- },
- xaxis: {
- type: 'category',
- data: xdataarr
- },
- yaxis: {
- type: 'value'
- },
- legend: { //��ϵ�н���ɸѡ
- data: ['δ�ݷ�', '�ݷ���'],
- width: '30%',
- right: 'center',
- bottom: '25%'
- },
- series: [{
- name: '�ݷ���',
- type: 'bar',
- stack: '�ͻ����',
- data: ydataarr2,
- z:10,
- label: {
- show: true,
- position: 'top',
- fontweight: 'bold',
- color:'white'
- //formatter:'{a}{b}{c}'
- },
- barwidth: '30%',
- itemstyle: {
- // color: 'rgba(201, 108, 21,1)'
- },
- },
- {
- name: 'δ�ݷ�',
- type: 'bar',
- stack: '�ͻ����',
- z:9,
- data: ydataarr3,
- label: { //��ʾ����
- show: 'true',
- position: 'top', //������ʾλ�ã�ĭ��inside
- color: 'rgba(126, 100, 52, 5)',
- formatter:'δ�ݷã�{c}',
- //formatter: '����:' ydataarr1[0] '\n�ݷ��ʣ�' (ydataarr2[0] / ydataarr1[0] * 100).tofixed(2)
- // '%',
- /* formatter: function(params) {
- //console.log(params);
- var sum = ydataarr1[params.dataindex];
- return params.seriesname ' ' sum '\n' params.name ':' params.value
- ' (' (params.value/sum*100).tofixed(2) '%)';
- },*/
- lineheight: 17
- },
- barwidth: '30%',
- itemstyle: { //��״����ɫ
- // color: 'rgba(61, 147, 37, 0.6)'
- }
- }
- ]
- }
- return option;
- })()
���ƴ���
��ã������ҵ�դ���롣 |
|