fusionchart

js: 
/***********************************************************增加fusionchart***********************************************/ 
        function tabActive() { 
            switch (g_Cur_Tab) { 
                case 0: 
                    $('#tabsArea').tabs({ selected: 0 }); 
                    break; 
                case 1: 
                    $('#tabsArea').tabs({ selected: 1 }); 
                    if (Is_Freshed == false) { 
                        showRunRateChart(QualityHisMgrRateChartAttrs, "持续改进成果信息度量"); 
                        Is_Freshed = true; 
                    } 
                    break; 
                default: 
                    $('#tabsArea').tabs({ selected: 0 }); 
                    break; 
            } 
        } 

        var g_chartWidth = 900; 
        var g_maxXaisNum = 12; 

        var g_yValueNum = 0; 
        var QualityHisMgrRateChartAttrs = { 
            reqUrl: '', 
            reqData: '', 
            chartId: 'QualityHisMgrRateRateChartId', 
            chartDivId: 'QualityHisMgrRateChartDiv', 
            chartUri: './../Content/charts/data/MSStackedColumn2DLineDY.swf', 
            chartInfo: '暂无数据', 
            width: g_chartWidth, 
            height: '350', 
            isDebug: '0', 
            isRegister: '1', 
            isLoaded: false, 
            isNull: false 
        } 

        function showRunRateChart(chartAttr, caption) { 
            progressDialog.showDialog("正在加载图表数据..."); 
            var content = ""; 

            $.ajax({ 
                url: 'LoadQualityHisMgrRateChartData', 
                data: {}, 
                cache: false, 
                async: true, 
                type: "POST", 
                dataType: 'json', 
                success: function (jdata) { 
                    progressDialog.hideDialog(); 
                    if (-1 == jdata.result) { 
                        alert("图表空间加载数据失败!"); 
                        return; 
                    } 
                    else { 
                        content = jdata.info; 
                        var chart = new FusionCharts(chartAttr.chartUri + "?ChartNoDataText=" + chartAttr.chartInfo, chartAttr.chartId, chartAttr.width, chartAttr.height, chartAttr.isDebug, chartAttr.isRegister); 
                        chart.setTransparent(true); 
                        chart.setDataXML(content); 
                        chart.render(chartAttr.chartDivId); 
                    } 
                } 
            }); 


        } 

        function loadQualityHisMgrDetailData(pid) { 
            tableQualityHisMgrQueryClick(pid); 
        } 

        function tableQualityHisMgrQueryClick(pid) { 
            $("#QualityHisMgrRateTableDiv").show(); 
            if (!$("#QualityHisMgrRateList").getGridParam("url")) { 
                loadRunRateTable(pid) 
                return; 
            } 

            var params = { pid: pid }; 
            $("#QualityHisMgrRateList").appendPostData(params); 
            $("#QualityHisMgrRateList").trigger("reloadGrid"); 
            $("#QualityHisMgrRateList").resetSelection(); 
        } 

        function loadRunRateTable(pid) { 
    //加载jqGrid 
        }


cs: 
public JsonResult LoadQualityHisMgrRateChartData() 
        { 
            try 
            { 
                iPAL.Models.Pub.iPAL_ManagerDataContext Pubdb = new iPAL_ManagerDataContext(); 
                string strContent = "<chart caption='持续改进成果信息度量视图' xaxisname='持续改进类别' PYaxisname='改进条目数' pYAxisMaxValue='100' labelStep='1' setAdaptiveSYMin='1' sNumberSuffix='' showValues='0' useRoundEdges='1' baseFontSize='12' labelDisplay='ROTATE' slantLabels='1'>"; 
                int iMaxIpalCount = 0; 
                //获取所有的持续改进成果 

                var list = (from a in  Pubdb.MANAGER_CFG_QUALITY_IMPROVE 
                            where a.pduid == int.Parse(Request.Cookies["MyPduId"].Value) 
                            select a).ToList(); 

                //获取category 
                string strcategory = "<categories font='Arial' fontSize='12' fontColor='000000'>"; 
                string strdataset = "<dataset><dataset seriesName='改进条目数' color='00FF00'>"; 
                string strlineset = string.Empty; 
                if (ConvUtils.ToString(Request.Cookies["MyPduId"].Value) == "PTN") 
                { 
                     strlineset = "<lineset seriesname='改进条目审核通过数' lineThickness='4'>"; 
                } 
                else 
                { 
                     strlineset = "<lineset seriesname='改进条目已固化数' lineThickness='4'>"; 
                } 
                foreach (MANAGER_CFG_QUALITY_IMPROVE obj in list) 
                { 
                    if (obj != null) 
                    { 
                        strcategory += "<category label='" + obj.qname + "'/>"; 
                        /*******************获取dataset--条数***************************************************************************************************************/ 
                        var templist = (from a in Pubdb.MANAGER_CFG_QUALITY_HIS where a.Pid == obj.Id select a).ToList(); 
                        strdataset += "<set value='" + templist.Count + "' link='JavaScript:loadQualityHisMgrDetailData(\"" + obj.Id + "\")' />"; 
                        if (templist.Count > iMaxIpalCount) 
                            iMaxIpalCount = templist.Count;

/********************************获取lineset--如果是非PTN则获取固化总数,如果是PTN则是通过审核总数*********************************************************************************************************************************/ 
                        if (ConvUtils.ToString(Request.Cookies["MyPduId"].Value) == "PTN") 
                        { 
                            int? icount = (from a in Pubdb.MANAGER_CFG_QUALITY_HIS.ToList() 
                                           where a.Pid == obj.Id && a.State == "yes" 
                                           select a).Count(); 

                            strlineset += "<set value='" + icount + "' />"; 
                        } 
                        else 
                        { 
                            int? icount = (from a in Pubdb.MANAGER_CFG_QUALITY_HIS.ToList() 
                                           where a.Pid == obj.Id && a.LinkType == 1 
                                           select a).Count(); 

                            strlineset += "<set value='" + icount + "' />"; 
                        } 

                    } 
                } 
                strcategory += "</categories>"; 
                strdataset += "</dataset></dataset>"; 
                strlineset += "</lineset></chart>"; 

                strContent = "<chart caption='持续改进成果信息度量视图' xaxisname='持续改进类别' PYaxisname='改进条目数' pYAxisMaxValue='" + (iMaxIpalCount * 2).ToString() + "' labelStep='1' setAdaptiveSYMin='1' sNumberSuffix='' showValues='0' useRoundEdges='1' baseFontSize='12' labelDisplay='ROTATE' slantLabels='1'>"; 
                strContent += strcategory + strdataset + strlineset; 

                var obj1 = new 
                { 
                    result = 1, 
                    info = strContent 
                }; 
                return Json(obj1, JsonRequestBehavior.AllowGet); 

            } 
            catch (Exception ex) 
            { 

                var obj = new 
                { 
                    result = -1, 
                    info = ex.Message 
                }; 
                return Json(obj, JsonRequestBehavior.AllowGet); 
            } 

        }

转载于:https://www.cnblogs.com/cw_volcano/archive/2011/08/08/2131402.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值