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);
}
}