bichart.js 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874
  1. if($ == undefined){
  2. $ = jQuery;
  3. }
  4. function crtChart(compId){
  5. var ispie = false;
  6. var isscatter = false;
  7. var isbubble = false;
  8. var ismap = false;
  9. if(curTmpInfo.charttype){
  10. ispie = curTmpInfo.charttype == 'pie' || curTmpInfo.charttype == 'gauge';
  11. isscatter = curTmpInfo.charttype == 'bubble' || curTmpInfo.charttype == 'scatter';
  12. isbubble = curTmpInfo.charttype == 'bubble';
  13. ismap = curTmpInfo.charttype == 'map';
  14. }else{
  15. var comp = findCompById(compId);
  16. ispie = comp.chartJson.type == 'pie' || comp.chartJson.type == 'gauge';
  17. isscatter = comp.chartJson.type == 'bubble' || comp.chartJson.type == 'scatter';
  18. isbubble = comp.chartJson.type == 'bubble';
  19. ismap = comp.chartJson.type == 'map';
  20. }
  21. if(ismap){
  22. return "<div class=\""+(curTmpInfo.chartpos=="left"?"tsbd":"tsbd2")+"\"><div class=\""+(curTmpInfo.chartpos=="left"?"ts_h":"ts_h2")+"\">地域:<div class=\"h_ctx\" id=\"xcol\"><span class=\"charttip\">将地域拖到这里</span></div></div><div class=\""+(curTmpInfo.chartpos=="left"?"ts_h":"ts_h2")+"\">度量:<div id=\"ycol\" class=\"h_ctx\"><span class=\"charttip\">将度量拖到这里</span></div></div></div><div class=\"chartctx\" style=\""+(curTmpInfo.chartpos=="top"?"margin-left:auto":"")+"\">图表预览区域</div>";
  23. }else{
  24. return "<div class=\""+(curTmpInfo.chartpos=="left"?"tsbd":"tsbd2")+"\">" + (isscatter?"<div class=\""+(curTmpInfo.chartpos=="left"?"ts_h":"ts_h2")+"\">" + (ispie ? "观察维度" : "横轴")+":<div id=\"y2col\" class=\"h_ctx\"><span class=\"charttip\">"+"将度量拖到这里"+"</span></div></div>":"<div class=\""+(curTmpInfo.chartpos=="left"?"ts_h":"ts_h2")+"\">" + (ispie ? "观察维度" : "横轴")+":<div id=\"xcol\" class=\"h_ctx\"><span class=\"charttip\">"+"将维度拖到这里"+"</span></div></div>") +
  25. "<div class=\""+(curTmpInfo.chartpos=="left"?"ts_h":"ts_h2")+"\">"+(ispie?"度量":"纵轴")+":<div id=\"ycol\" class=\"h_ctx\"><span class=\"charttip\">将度量拖到这里</span></div></div>" +
  26. (isbubble ? "<div class=\""+(curTmpInfo.chartpos=="left"?"ts_h":"ts_h2")+"\">气泡大小:<div id=\"y3col\" class=\"h_ctx\"><span class=\"charttip\">将度量拖到这里</span></div></div>":"") +
  27. (isscatter?"<div class=\""+(curTmpInfo.chartpos=="left"?"ts_h":"ts_h2")+"\">观察维度:<div id=\"xcol\" class=\"h_ctx\"><span class=\"charttip\">"+"将维度拖到这里"+"</span></div></div>":"") +
  28. (isbubble ? "":"<div class=\""+(curTmpInfo.chartpos=="left"?"ts_h":"ts_h2")+"\" "+(ispie?"style=\"display:none\"":"")+">图例:<div id=\"scol\" class=\"h_ctx\"><span class=\"charttip\">将维度拖到这里</span></div></div>") + "</div>" +
  29. (ispie||isscatter||curTmpInfo.chartpos=="top" ? "" :"<div class=\"exchangexs\"><img src='../resource/img/exchangexs1.gif'><a title='交换维度' href='javascript:exchangexs("+compId+", true);'><img src='../resource/img/reload.png' border='0'></a><img src='../resource/img/exchangexs2.gif'></div>") +
  30. "<div class=\"chartctx\" style=\""+(curTmpInfo.chartpos=="top"?"margin-left:auto;":"")+(isscatter?"height:220px;":"")+"\">图表预览区域</div>";
  31. }
  32. }
  33. function updateChart(){
  34. var comp = findCompById(2);
  35. $('#pdailog').dialog({
  36. title: '切换图表',
  37. width: 400,
  38. height: 340,
  39. closed: false,
  40. cache: false,
  41. modal: true,
  42. toolbar:null,
  43. buttons:[{
  44. text:'确定',
  45. iconCls:'icon-ok',
  46. handler:function(){
  47. if(curTmpInfo.selectChart == undefined){
  48. msginfo("您还未选择图表,请点击图表示意图片,再点确认按钮。");
  49. }else{
  50. var tp = comp.chartJson.type = curTmpInfo.selectChart;
  51. //清除数据
  52. delete curTmpInfo.selectChart;
  53. delete comp.kpiJson[1];
  54. delete comp.kpiJson[2];
  55. if(tp == "pie" || tp == "gauge"){
  56. delete comp.chartJson.scol;
  57. }
  58. $('#pdailog').dialog('close');
  59. var str = crtChart(comp.id);
  60. $("#chartarea div.ctx").html(str);
  61. backChartData(comp);
  62. if(tp == 'bubble' || tp == 'scatter'){
  63. initChartByScatter(2);
  64. }else{
  65. initChartKpiDrop(2)
  66. }
  67. chartview(comp, comp.id);
  68. }
  69. }
  70. },{
  71. text:'取消',
  72. iconCls:"icon-cancel",
  73. handler:function(){
  74. //清除数据
  75. delete curTmpInfo.selectChart;
  76. $('#pdailog').dialog('close');
  77. }
  78. }]
  79. });
  80. $('#pdailog').dialog('refresh', 'insertChart.action?tp=' + comp.chartJson.type);
  81. }
  82. function chartcss(){
  83. $(".chartselect .selleft ul li").bind("click", function(){
  84. var cid = $(this).attr("cid");
  85. $(".chartselect .selleft ul li").removeClass("select");
  86. $(this).addClass("select");
  87. $(".chartselect .selright .one").css("display", "none");
  88. $("#schart" + cid).css("display", "block");
  89. //默认选图表
  90. //$(".chartselect .selright .one").css("border", "none");
  91. //$("#schart" + cid).css("border","1px solid #FF0000");
  92. var tp = $("#schart" + cid).attr("tp");
  93. curTmpInfo.selectChart = tp;
  94. });
  95. //默认值
  96. var cid = $(".chartselect .selleft li.select").attr("cid");
  97. $(".chartselect .selright .one").css("display", "none");
  98. $("#schart" + cid).css("display", "block");
  99. curTmpInfo.selectChart = $("#schart" + cid).attr("tp");;
  100. }
  101. function chartview(json, compId){
  102. if(json.kpiJson == undefined || json.kpiJson.length == 0){
  103. return;
  104. }
  105. if(json.chartJson.type == "scatter" && (json.kpiJson.length < 2 || json.kpiJson[1] == null) ){
  106. return;
  107. }
  108. if(json.chartJson.type == "bubble" && (json.kpiJson.length < 3 || json.kpiJson[2] == null ) ){
  109. return;
  110. }
  111. __showLoading();
  112. var kpiType = json.ttype;
  113. var json = {"chartJson":json.chartJson, "kpiJson":json.kpiJson, "compId":compId, "params":pageInfo.params, dsid:json.dsid, dsetId:json.dsetId};
  114. $.ajax({
  115. type: "POST",
  116. url: "ChartView.action",
  117. dataType:"html",
  118. contentType : "application/json",
  119. data: JSON.stringify(json),
  120. success: function(resp){
  121. __hideLoading();
  122. //清除DIV高度
  123. $("#T" + compId + " div.chartctx").css("height", "auto");
  124. $("#T" + compId + " div.chartctx").html(resp);
  125. },
  126. error:function(resp){
  127. __hideLoading();
  128. $.messager.alert('出错了','系统出错,请联系管理员。','error');
  129. }
  130. });
  131. }
  132. function initChartKpiDrop(id){
  133. $("#T" + id + " #xcol, #T" + id +" #ycol, #T"+id+" #scol").droppable({
  134. accept:"ul.chartTreeCss .tree-node",
  135. onDragEnter:function(e,source){
  136. var node = $("#datasettree").tree("getNode", source);
  137. var tp = node.attributes.col_type;
  138. if(tp == 1 && ($(this).attr("id") == 'xcol' || $(this).attr("id") == 'scol')){
  139. $(source).draggable('proxy').find("span").removeClass("tree-dnd-no");
  140. $(source).draggable('proxy').find("span").addClass("tree-dnd-yes");
  141. $("#T"+id+" #"+$(this).attr("id")).css("border-color", "#ff0000");
  142. }
  143. if(tp == 2 && $(this).attr("id") == "ycol"){
  144. $(source).draggable('proxy').find("span").removeClass("tree-dnd-no");
  145. $(source).draggable('proxy').find("span").addClass("tree-dnd-yes");
  146. $("#T"+id+" #ycol").css("border-color", "#ff0000");
  147. }
  148. e.cancelBubble=true;
  149. e.stopPropagation(); //阻止事件冒泡
  150. },
  151. onDragLeave:function(e,source){
  152. $(source).draggable('proxy').find("span").addClass("tree-dnd-no");
  153. $(source).draggable('proxy').find("span").removeClass("tree-dnd-yes");
  154. $("#T"+id+" #"+$(this).attr("id")).css("border-color", "#7F9DB9");
  155. e.cancelBubble=true;
  156. e.stopPropagation(); //阻止事件冒泡
  157. },
  158. onDrop:function(e,source){
  159. var id = $(this).parents(".comp_table").attr("id").replace("T","");
  160. var json = findCompById(Number(id));
  161. //清除边框样式
  162. $("#T"+id+" #"+$(this).attr("id")).css("border-color", "#7F9DB9");
  163. //获取TREE
  164. var node = $("#datasettree").tree("getNode", source);
  165. e.cancelBubble=true;
  166. e.stopPropagation(); //阻止事件冒泡
  167. //判断拖入的维度及度量是否和以前维度及度量在同一个表。
  168. if(json.cubeId != undefined){
  169. if(json.cubeId != node.attributes.cubeId){
  170. msginfo("您拖入的"+ (node.attributes.col_type == 2 ? "度量" : "维度") +"与组件已有的内容不在同一个数据表中,拖放失败。");
  171. return;
  172. }
  173. }
  174. /**
  175. //判断拖入的度量是否是(同比、环比),如果是,需要判断当前维度是否有date类型
  176. if(node.attributes.calc_kpi == 1){
  177. if(!isExistDateDim(json, 'chart')){
  178. msginfo("您拖入的度量需要图形中有时间类型的维度(年/季度/月/日)。");
  179. return;
  180. }
  181. }**/
  182. json.cubeId = node.attributes.cubeId;
  183. json.dsid = node.attributes.dsid;
  184. json.dsetId = node.attributes.dsetId;
  185. json.chartJson.label = "PIC";
  186. if(json.kpiJson == undefined){
  187. json.kpiJson = [];
  188. };
  189. /**
  190. if(!json.chartJson || !json.chartJson.xcol || !json.chartJson.ycol || !json.chartJson.scol || !json.chartJson.params){
  191. json.chartJson = {"xcol":{}, "ycol":{}, "scol":{}, "params":[]};
  192. }
  193. **/
  194. //拖放度量后,判断维度是否在params中
  195. if(node.attributes.col_type == 1){
  196. var dimId = node.attributes.col_id;
  197. if(findDimById(dimId, json.chartJson.params) != null){
  198. msginfo("您拖放的维度已存在于钻取维中,不能拖放。")
  199. return;
  200. }
  201. }
  202. if(node.attributes.col_type == 2 && $(this).attr("id") == "ycol"){
  203. json.kpiJson = [];
  204. json.kpiJson.push({"kpi_id":node.attributes.col_id, "kpi_name" : node.text, "col_name":node.attributes.col_name, "aggre":node.attributes.aggre, "fmt":node.attributes.fmt, "alias":node.attributes.alias,"tname":node.attributes.tname,"unit":node.attributes.unit,"rate":node.attributes.rate,"calc":node.attributes.calc});
  205. json.chartJson.ycol = {"type":"kpi"};
  206. $(this).html("<span title=\""+node.text+"\" class=\"charttxt\">" + node.text + "</span><span class=\"charticon\" title=\"配置\" onclick=\"chartmenu(this, "+node.attributes.col_id+",'ycol','"+node.text+"')\"></span>");
  207. curTmpInfo.isupdate = true;
  208. chartview(json, id);
  209. }
  210. if(node.attributes.col_type == 1 && $(this).attr("id") == "xcol"){
  211. //判断是否在xcol中已经存在
  212. if(json.chartJson.scol != undefined && json.chartJson.scol.id == node.attributes.col_id){
  213. msginfo("您拖放的维度已存在于图例项中,不能拖放。")
  214. return;
  215. }
  216. //判断xcol 和 scol 是否属于一个分组,如果是,不让拖动
  217. var gt = node.attributes.grouptype;
  218. if(gt != null && gt != ''){
  219. if(json.chartJson.scol != undefined && json.chartJson.scol.grouptype == gt){
  220. msginfo("您拖放的维度与此图表中已有维度分组相同,不能拖放。")
  221. return;
  222. }
  223. }
  224. json.chartJson.xcol = {"id":node.attributes.col_id, "dimdesc" : node.text, "type":node.attributes.dim_type, "colname":node.attributes.col_name,"alias":node.attributes.alias,"tname":node.attributes.tname,"iscas":node.attributes.iscas, "tableName":node.attributes.tableName, "tableColKey":node.attributes.tableColKey,"tableColName":node.attributes.tableColName, "dimord":node.attributes.dimord, "dim_name":node.attributes.dim_name, "grouptype":node.attributes.grouptype,"valType":node.attributes.valType, "ordcol":node.attributes.ordcol,dateformat:node.attributes.dateformat,"calc":node.attributes.calc};
  225. $(this).html("<span title=\""+node.text+"\" class=\"charttxt\">" + node.text + "</span><span class=\"charticon\" title=\"配置\" onclick=\"chartmenu(this, "+node.attributes.col_id+",'xcol', '"+node.text+"')\"></span>");
  226. curTmpInfo.isupdate = true;
  227. chartview(json, id);
  228. }
  229. if(node.attributes.col_type == 1 && $(this).attr("id") == "scol"){
  230. //判断是否在xcol中已经存在
  231. if(json.chartJson.xcol != undefined && json.chartJson.xcol.id == node.attributes.col_id){
  232. msginfo("您拖放的维度已存在于横轴中,不能拖放。")
  233. return;
  234. }
  235. //判断xcol 和 scol 是否属于一个分组,如果是,不让拖动
  236. var gt = node.attributes.grouptype;
  237. if(gt != null && gt != ''){
  238. if(json.chartJson.xcol != undefined && json.chartJson.xcol.grouptype == gt){
  239. msginfo("您拖放的维度与此图表中已有维度分组相同,不能拖放。")
  240. return;
  241. }
  242. }
  243. json.chartJson.scol = {"id":node.attributes.col_id, "dimdesc" : node.text, "type":node.attributes.dim_type, "colname":node.attributes.col_name,"alias":node.attributes.alias,"tname":node.attributes.tname,"iscas":node.attributes.iscas, "tableName":node.attributes.tableName, "tableColKey":node.attributes.tableColKey,"tableColName":node.attributes.tableColName, "dimord":node.attributes.dimord, "dim_name":node.attributes.dim_name, "grouptype":node.attributes.grouptype,"valType":node.attributes.valType, "ordcol":node.attributes.ordcol,"calc":node.attributes.calc};
  244. $(this).html("<span title=\""+node.text+"\" class=\"charttxt\">" + node.text + "</span><span class=\"charticon\" title=\"配置\" onclick=\"chartmenu(this,"+node.attributes.col_id+", 'scol', '"+node.text+"')\"></span>");
  245. curTmpInfo.isupdate = true;
  246. chartview(json, id);
  247. }
  248. }
  249. });
  250. }
  251. /**
  252. 对于气泡图、 散点图, 横轴和纵轴都是度量,序列是维度,处理方式和其他图表不一样,需特殊处理
  253. */
  254. function initChartByScatter(id){
  255. $("#T" + id + " #xcol, #T" + id +" #ycol, #T"+id+" #y2col, #T"+id+" #y3col, #T"+id+" #scol").droppable({
  256. accept:"ul.chartTreeCss .tree-node",
  257. onDragEnter:function(e,source){
  258. var node = $("#datasettree").tree("getNode", source);
  259. var tp = node.attributes.col_type;
  260. if(tp == 1 && ($(this).attr("id") == 'scol' || $(this).attr("id") == 'xcol' )){
  261. $(source).draggable('proxy').find("span").removeClass("tree-dnd-no");
  262. $(source).draggable('proxy').find("span").addClass("tree-dnd-yes");
  263. $("#T"+id+" #"+$(this).attr("id")).css("border-color", "#ff0000");
  264. }
  265. if(tp == 2 && ($(this).attr("id") == "ycol" || $(this).attr("id") == 'y2col' || $(this).attr("id") == 'y3col')){
  266. $(source).draggable('proxy').find("span").removeClass("tree-dnd-no");
  267. $(source).draggable('proxy').find("span").addClass("tree-dnd-yes");
  268. $("#T"+id+" #"+$(this).attr("id")).css("border-color", "#ff0000");
  269. }
  270. e.cancelBubble=true;
  271. e.stopPropagation(); //阻止事件冒泡
  272. },
  273. onDragLeave:function(e,source){
  274. $(source).draggable('proxy').find("span").addClass("tree-dnd-no");
  275. $(source).draggable('proxy').find("span").removeClass("tree-dnd-yes");
  276. $("#T"+id+" #"+$(this).attr("id")).css("border-color", "#7F9DB9");
  277. e.cancelBubble=true;
  278. e.stopPropagation(); //阻止事件冒泡
  279. },
  280. onDrop:function(e,source){
  281. var id = $(this).parents(".comp_table").attr("id").replace("T","");
  282. var json = findCompById(Number(id));
  283. //清除边框样式
  284. $("#T"+id+" #"+$(this).attr("id")).css("border-color", "#7F9DB9");
  285. //获取TREE
  286. var node = $("#datasettree").tree("getNode", source);
  287. e.cancelBubble=true;
  288. e.stopPropagation(); //阻止事件冒泡
  289. //判断拖入的维度及度量是否和以前维度及度量在同一个表。
  290. if(json.cubeId != undefined){
  291. if(json.cubeId != node.attributes.cubeId){
  292. msginfo("您拖入的"+ (node.attributes.col_type == 2 ? "度量" : "维度") +"与组件已有的内容不在同一个数据表中,拖放失败。");
  293. return;
  294. }
  295. }
  296. //判断拖入的度量是否是(同比、环比),如果是,需要判断当前维度是否有date类型
  297. if(node.attributes.calc_kpi == 1){
  298. if(!isExistDateDim(json, 'chart')){
  299. msginfo("您拖入的度量需要图形中有时间类型的维度(年/季度/月/日)。");
  300. return;
  301. }
  302. }
  303. json.cubeId = node.attributes.cubeId;
  304. json.dsid = node.attributes.dsid;
  305. json.dsetId = node.attributes.dsetId;
  306. json.chartJson.label = "PIC";
  307. if(json.kpiJson == undefined){
  308. json.kpiJson = [];
  309. };
  310. //拖放度量后,判断维度是否在params中
  311. if(node.attributes.col_type == 1){
  312. var dimId = node.attributes.col_id;
  313. if(findDimById(dimId, json.chartJson.params) != null){
  314. msginfo("您拖放的维度已存在于钻取维中,不能拖放。")
  315. return;
  316. }
  317. }
  318. if(node.attributes.col_type == 2 && $(this).attr("id") == "ycol"){
  319. if(!json.kpiJson){
  320. json.kpiJson = [null, null, null];
  321. }
  322. //判断度量是否存在
  323. if((json.kpiJson[1] != null && json.kpiJson[1].kpi_id == node.attributes.col_id) || (json.kpiJson[2] != null && json.kpiJson[2].kpi_id == node.attributes.col_id)){
  324. msginfo("您拖放的度量已存在当前图表中。")
  325. return;
  326. }
  327. json.kpiJson[0] = {"kpi_id":node.attributes.col_id, "kpi_name" : node.text, "col_name":node.attributes.col_name, "aggre":node.attributes.aggre, "fmt":node.attributes.fmt, "alias":node.attributes.alias,"tname":node.attributes.tname,"unit":node.attributes.unit,"rate":node.attributes.rate,"calc":node.attributes.calc};
  328. json.chartJson.ycol = {"type":"kpi"};
  329. $(this).html("<span title=\""+node.text+"\" class=\"charttxt\">" + node.text + "</span><span class=\"charticon\" title=\"配置\" onclick=\"chartmenu(this, "+node.attributes.col_id+",'ycol','"+node.text+"')\"></span>");
  330. curTmpInfo.isupdate = true;
  331. if(json.chartJson.type == 'scatter'){
  332. if(json.kpiJson[0] != null && json.kpiJson[1] != null){
  333. chartview(json, id);
  334. }
  335. }
  336. if(json.chartJson.type == 'bubble'){
  337. if(json.kpiJson[0] != null && json.kpiJson[1] != null && json.kpiJson[2] != null){
  338. chartview(json, id);
  339. }
  340. }
  341. }
  342. if(node.attributes.col_type == 2 && $(this).attr("id") == "y2col"){
  343. if(!json.kpiJson){
  344. json.kpiJson = [null, null, null];
  345. }
  346. //判断度量是否存在
  347. if((json.kpiJson[0] != null && json.kpiJson[0].kpi_id == node.attributes.col_id) || (json.kpiJson[2] != null && json.kpiJson[2].kpi_id == node.attributes.col_id)){
  348. msginfo("您拖放的度量已存在当前图表中。")
  349. return;
  350. }
  351. var kpi = {"kpi_id":node.attributes.col_id, "kpi_name" : node.text, "col_name":node.attributes.col_name, "aggre":node.attributes.aggre, "fmt":node.attributes.fmt, "alias":node.attributes.alias,"tname":node.attributes.tname,"unit":node.attributes.unit,"rate":node.attributes.rate,"calc":node.attributes.calc};
  352. json.kpiJson[1] = kpi;
  353. $(this).html("<span title=\""+node.text+"\" class=\"charttxt\">" + node.text + "</span><span class=\"charticon\" title=\"配置\" onclick=\"chartmenu(this, "+node.attributes.col_id+",'y2col','"+node.text+"')\"></span>");
  354. curTmpInfo.isupdate = true;
  355. if(json.chartJson.type == 'scatter'){
  356. if(json.kpiJson[0] != null && json.kpiJson[1] != null){
  357. chartview(json, id);
  358. }
  359. }
  360. if(json.chartJson.type == 'bubble'){
  361. if(json.kpiJson[0] != null && json.kpiJson[1] != null && json.kpiJson[2] != null){
  362. chartview(json, id);
  363. }
  364. }
  365. }
  366. if(node.attributes.col_type == 2 && $(this).attr("id") == "y3col"){
  367. if(!json.kpiJson){
  368. json.kpiJson = [null, null, null];
  369. }
  370. //判断度量是否存在
  371. if((json.kpiJson[0] != null && json.kpiJson[0].kpi_id == node.attributes.col_id) || (json.kpiJson[1] != null && json.kpiJson[1].kpi_id == node.attributes.col_id)){
  372. msginfo("您拖放的度量已存在当前图表中。")
  373. return;
  374. }
  375. var kpi = {"kpi_id":node.attributes.col_id, "kpi_name" : node.text, "col_name":node.attributes.col_name, "aggre":node.attributes.aggre, "fmt":node.attributes.fmt, "alias":node.attributes.alias,"tname":node.attributes.tname,"unit":node.attributes.unit,"rate":node.attributes.rate,"calc":node.attributes.calc};
  376. json.kpiJson[2] = kpi;
  377. $(this).html("<span title=\""+node.text+"\" class=\"charttxt\">" + node.text + "</span><span class=\"charticon\" title=\"配置\" onclick=\"chartmenu(this, "+node.attributes.col_id+",'y3col','"+node.text+"')\"></span>");
  378. curTmpInfo.isupdate = true;
  379. if(json.chartJson.type == 'scatter'){
  380. if(json.kpiJson[0] != null && json.kpiJson[1] != null){
  381. chartview(json, id);
  382. }
  383. }
  384. if(json.chartJson.type == 'bubble'){
  385. if(json.kpiJson[0] != null && json.kpiJson[1] != null && json.kpiJson[2] != null){
  386. chartview(json, id);
  387. }
  388. }
  389. }
  390. if(node.attributes.col_type == 1 && $(this).attr("id") == "xcol"){
  391. //判断是否在xcol中已经存在
  392. if(json.chartJson.scol != undefined && json.chartJson.scol.id == node.attributes.col_id){
  393. msginfo("您拖放的维度已存在于图例项中,不能拖放。")
  394. return;
  395. }
  396. //判断xcol 和 scol 是否属于一个分组,如果是,不让拖动
  397. var gt = node.attributes.grouptype;
  398. if(gt != null && gt != ''){
  399. if(json.chartJson.scol != undefined && json.chartJson.scol.grouptype == gt){
  400. msginfo("您拖放的维度与此图表中已有维度分组相同,不能拖放。")
  401. return;
  402. }
  403. }
  404. json.chartJson.xcol = {"id":node.attributes.col_id, "dimdesc" : node.text, "type":node.attributes.dim_type, "colname":node.attributes.col_name,"alias":node.attributes.alias,"tname":node.attributes.tname,"iscas":node.attributes.iscas, "tableName":node.attributes.tableName, "tableColKey":node.attributes.tableColKey,"tableColName":node.attributes.tableColName, "dimord":node.attributes.dimord, "dim_name":node.attributes.dim_name, "grouptype":node.attributes.grouptype,"valType":node.attributes.valType, "ordcol":node.attributes.ordcol,"calc":node.attributes.calc};
  405. $(this).html("<span title=\""+node.text+"\" class=\"charttxt\">" + node.text + "</span><span class=\"charticon\" title=\"配置\" onclick=\"chartmenu(this, "+node.attributes.col_id+",'xcol', '"+node.text+"')\"></span>");
  406. curTmpInfo.isupdate = true;
  407. if(json.chartJson.type == 'scatter'){
  408. if(json.kpiJson[0] != null && json.kpiJson[1] != null){
  409. chartview(json, id);
  410. }
  411. }
  412. if(json.chartJson.type == 'bubble'){
  413. if(json.kpiJson[0] != null && json.kpiJson[1] != null && json.kpiJson[2] != null){
  414. chartview(json, id);
  415. }
  416. }
  417. }
  418. if(node.attributes.col_type == 1 && $(this).attr("id") == "scol"){
  419. //判断是否在xcol中已经存在
  420. if(json.chartJson.xcol != undefined && json.chartJson.xcol.id == node.attributes.col_id){
  421. msginfo("您拖放的维度已存在于横轴中,不能拖放。")
  422. return;
  423. }
  424. //判断xcol 和 scol 是否属于一个分组,如果是,不让拖动
  425. var gt = node.attributes.grouptype;
  426. if(gt != null && gt != ''){
  427. if(json.chartJson.xcol != undefined && json.chartJson.xcol.grouptype == gt){
  428. msginfo("您拖放的维度与此图表中已有维度分组相同,不能拖放。")
  429. return;
  430. }
  431. }
  432. json.chartJson.scol = {"id":node.attributes.col_id, "dimdesc" : node.text, "type":node.attributes.dim_type, "colname":node.attributes.col_name,"alias":node.attributes.alias,"tname":node.attributes.tname,"iscas":node.attributes.iscas, "tableName":node.attributes.tableName, "tableColKey":node.attributes.tableColKey,"tableColName":node.attributes.tableColName, "dimord":node.attributes.dimord, "dim_name":node.attributes.dim_name, "grouptype":node.attributes.grouptype,"valType":node.attributes.valType, "ordcol":node.attributes.ordcol,"calc":node.attributes.calc};
  433. $(this).html("<span title=\""+node.text+"\" class=\"charttxt\">" + node.text + "</span><span class=\"charticon\" title=\"配置\" onclick=\"chartmenu(this,"+node.attributes.col_id+", 'scol', '"+node.text+"')\"></span>");
  434. curTmpInfo.isupdate = true;
  435. if(json.chartJson.type == 'scatter'){
  436. if(json.kpiJson[0] != null && json.kpiJson[1] != null){
  437. chartview(json, id);
  438. }
  439. }
  440. if(json.chartJson.type == 'bubble'){
  441. if(json.kpiJson[0] != null && json.kpiJson[1] != null && json.kpiJson[2] != null){
  442. chartview(json, id);
  443. }
  444. }
  445. }
  446. }
  447. });
  448. }
  449. //回写横轴、纵轴、图例等内容
  450. function backChartData(comp){
  451. var id = comp.id;
  452. if(!$.isEmptyObject(comp.chartJson.xcol)){
  453. var node = comp.chartJson.xcol;
  454. $("#T" + id + " #xcol").html("<span title=\""+node.dimdesc+"\" class=\"charttxt\">" + node.dimdesc + "</span><span class=\"charticon\" title=\"配置\" onclick=\"chartmenu(this, "+node.id+",'xcol', '"+node.dimdesc+"')\"></span>");
  455. }
  456. if(!$.isEmptyObject(comp.chartJson.ycol)){
  457. var node = comp.kpiJson[0];
  458. $("#T" + id + " #ycol").html("<span title=\""+node.kpi_name+"\" class=\"charttxt\">" + node.kpi_name + "</span><span class=\"charticon\" title=\"配置\" onclick=\"chartmenu(this, "+node.kpi_id+",'ycol','"+node.kpi_name+"')\"></span>");
  459. }
  460. /**
  461. 气泡图3个度量,散点图两个度量
  462. **/
  463. //回写y2
  464. if(comp.kpiJson && (comp.chartJson.type == 'scatter' || comp.chartJson.type == 'bubble')){
  465. var node = comp.kpiJson[1];
  466. if(node != null){
  467. $("#T" + id + " #y2col").html("<span title=\""+node.kpi_name+"\" class=\"charttxt\">" + node.kpi_name + "</span><span class=\"charticon\" title=\"配置\" onclick=\"chartmenu(this, "+node.kpi_id+",'y2col','"+node.kpi_name+"')\"></span>");
  468. }
  469. //回写y3
  470. node = comp.kpiJson[2];
  471. if(node != null){
  472. $("#T" + id + " #y3col").html("<span title=\""+node.kpi_name+"\" class=\"charttxt\">" + node.kpi_name + "</span><span class=\"charticon\" title=\"配置\" onclick=\"chartmenu(this, "+node.kpi_id+",'y3col','"+node.kpi_name+"')\"></span>");
  473. }
  474. }
  475. if(!$.isEmptyObject(comp.chartJson.scol)){
  476. if(comp.chartJson.type != 'pie' && comp.chartJson.type != 'gauge'){
  477. var node = comp.chartJson.scol;
  478. $("#T" + id + " #scol").html("<span title=\""+node.dimdesc+"\" class=\"charttxt\">" + node.dimdesc + "</span><span class=\"charticon\" title=\"配置\" onclick=\"chartmenu(this,"+node.id+", 'scol', '"+node.dimdesc+"')\"></span>");
  479. }
  480. }
  481. }
  482. function chartmenu(ts, id, tp, name){
  483. var offset = $(ts).offset();
  484. //放入临时对象中,方便下次获取
  485. curTmpInfo.ckid = id;
  486. curTmpInfo.tp = tp;
  487. curTmpInfo.compId = $(ts).parents(".comp_table").attr("id").replace("T","");
  488. curTmpInfo.dimname = name;
  489. if(tp == 'ycol' || tp == 'y2col' || tp=='y3col'){
  490. $("#chartoptmenu").menu("enableItem", $("#m_set"));
  491. }else{
  492. $("#chartoptmenu").menu("disableItem", $("#m_set"));
  493. }
  494. $("#chartoptmenu").menu("show", {left:offset.left, top:offset.top + 20});
  495. }
  496. function chartsort(sorttp){
  497. var tp = curTmpInfo.tp;
  498. var compId = curTmpInfo.compId;
  499. var id = curTmpInfo.ckid;
  500. var json = findCompById(compId);
  501. if(tp == 'xcol'){
  502. //清除度量排序,因为度量排序最优先
  503. delete json.kpiJson[0].sort;
  504. json.chartJson.xcol.dimord = sorttp;
  505. }
  506. if(tp == 'ycol'){
  507. json.kpiJson[0].sort = sorttp;
  508. }
  509. if(tp == 'scol'){
  510. //清除度量排序
  511. delete json.kpiJson[0].sort;
  512. json.chartJson.scol.dimord = sorttp;
  513. }
  514. curTmpInfo.isupdate = true;
  515. chartview(json, compId);
  516. }
  517. function delChartKpiOrDim(){
  518. var tp = curTmpInfo.tp;
  519. var compId = curTmpInfo.compId;
  520. var id = curTmpInfo.ckid;
  521. var json = findCompById(compId);
  522. if(tp == 'xcol'){
  523. json.chartJson.xcol = {};
  524. $("#T"+compId+" #xcol").html("<span class=\"charttip\">将维度拖到这里</span>");
  525. curTmpInfo.isupdate = true;
  526. chartview(json, compId);
  527. }
  528. if(tp == 'ycol'){
  529. json.chartJson.ycol = {};
  530. if(json.kpiJson.length > 1){
  531. json.kpiJson[0] = null;
  532. }else{
  533. json.kpiJson = [];
  534. }
  535. $("#T"+compId+" #ycol").html("<span class=\"charttip\">将度量拖到这里</span>");
  536. }
  537. if(tp == 'y2col'){
  538. if(json.kpiJson.length > 1){
  539. json.kpiJson[1] = null;
  540. }else{
  541. json.kpiJson = [];
  542. }
  543. $("#T"+compId+" #y2col").html("<span class=\"charttip\">将度量拖到这里</span>");
  544. }
  545. if(tp == 'y3col'){
  546. json.kpiJson[2] = null;
  547. $("#T"+compId+" #y3col").html("<span class=\"charttip\">将度量拖到这里</span>");
  548. }
  549. if(tp == 'scol'){
  550. json.chartJson.scol = {};
  551. $("#T"+compId+" #scol").html("<span class=\"charttip\">将维度拖到这里</span>");
  552. curTmpInfo.isupdate = true;
  553. chartview(json, compId);
  554. }
  555. }
  556. function setChartKpi(){
  557. var tp = curTmpInfo.tp;
  558. if(tp == 'xcol' || tp == 'scol'){
  559. return;
  560. }
  561. var dimid = curTmpInfo.ckid;
  562. var compId = curTmpInfo.compId.replace("T", "");
  563. var name = curTmpInfo.dimname;
  564. //获取组件的JSON对象
  565. var comp = findCompById(compId);
  566. var kpi = null;
  567. if(tp == 'ycol'){
  568. kpi = comp.kpiJson[0];
  569. }else if(tp == 'y2col'){
  570. kpi = comp.kpiJson[1];
  571. }else if(tp == 'y3col'){
  572. kpi = comp.kpiJson[2];
  573. }
  574. var ctx = "<div style='line-height:25px; margin:5px;'><span class=\"inputtext\">度量名称:</span>"+kpi.kpi_name+"<br><span class=\"inputtext\">度量单位:</span><select id=\"kpiunit\" name=\"kpiunit\" class=\"inputform2\"><option value='1'></option><option value='1000'>千</option><option value='10000'>万</option><option value='1000000'>百万</option><option value='100000000'>亿</option></select>"+kpi.unit+"<br><span class=\"inputtext\">格 式 化:</span><select id=\"fmt\" name=\"fmt\" class=\"inputform2\"><option value=\"\"></option><option value=\"###,##0\">整数</option><option value=\"###,##0.0\">小数</option><option value=\"0.00%\">百分比</option></select></div>";
  575. $('#pdailog').dialog({
  576. title: '度量属性',
  577. width: 360,
  578. height: 260,
  579. closed: false,
  580. cache: false,
  581. modal: true,
  582. content: ctx,
  583. toolbar:null,
  584. buttons:[{
  585. text:'确定',
  586. iconCls:'icon-ok',
  587. handler:function(){
  588. kpi.fmt = $("#pdailog #fmt").val();
  589. kpi.rate = Number($("#pdailog #kpiunit").val());
  590. $('#pdailog').dialog('close');
  591. curTmpInfo.isupdate = true;
  592. chartview(comp, compId);
  593. }
  594. },{
  595. text:'取消',
  596. iconCls:"icon-cancel",
  597. handler:function(){
  598. $('#pdailog').dialog('close');
  599. }
  600. }]
  601. });
  602. $("#pdailog #fmt").find("option[value='"+kpi.fmt+"']").attr("selected",true);
  603. $("#pdailog #kpiunit").find("option[value='"+kpi.rate+"']").attr("selected",true);
  604. }
  605. function chartfilterDims(){
  606. var tp = curTmpInfo.tp;
  607. var dimid = curTmpInfo.ckid;
  608. var compId = curTmpInfo.compId.replace("T", "");
  609. var name = curTmpInfo.dimname;
  610. //获取组件的JSON对象
  611. var comp = findCompById(compId);
  612. var dim = null;
  613. if(tp == 'xcol'){
  614. dim = comp.chartJson.xcol;
  615. }else if(tp == 'scol'){
  616. dim = comp.chartJson.scol;
  617. }else{
  618. //度量筛选页面
  619. //return setChartKpi(dimid, compId, comp, name);
  620. return kpiFilter('chart');
  621. }
  622. $('#pdailog').dialog({
  623. title: name + ' - 维度筛选',
  624. width: 300,
  625. height: 321,
  626. closed: false,
  627. cache: false,
  628. modal: true,
  629. content:'<div id="div_chartfilter"><div class="panel-loading">Loading...</div></div>',
  630. buttons:[{
  631. text:'确定',
  632. iconCls:'icon-ok',
  633. handler:function(){
  634. //获取选择项
  635. var tab = $('#dimfiltertab').tabs('getSelected');
  636. var index = $('#dimfiltertab').tabs('getTabIndex',tab);
  637. if("day" == dim.type && index == 0){
  638. var st = $("#dimfiltertab #dft2").val();
  639. var ed = $("#dimfiltertab #dft1").val();
  640. //判断是否st < ed
  641. if(Number(st.replace(/-/g, "")) > Number(ed.replace(/-/g, ""))){
  642. msginfo("您选择的开始日期不能大于结束日期。");
  643. return;
  644. }
  645. dim.startdt = st;
  646. dim.enddt = ed;
  647. dim.filtertype = 1;
  648. delete dim.vals;
  649. }else if("month" == dim.type && index == 0){
  650. var st = $("#dimfiltertab #dfm2").val();
  651. var ed = $("#dimfiltertab #dfm1").val();
  652. //判断是否st < ed
  653. if(Number(st) > Number(ed)){
  654. msginfo("您选择的开始月份不能大于结束月份。");
  655. return;
  656. }
  657. dim.startmt = st;
  658. dim.endmt = ed;
  659. dim.filtertype = 1;
  660. delete dim.vals;
  661. }else{
  662. //获取勾选值
  663. var vals = "";
  664. var seles = $("#pdailog input[name='dimval']:checkbox:checked");
  665. seles.each(function(a, b){
  666. vals = vals + $(this).val();
  667. if(a != seles.size() - 1){
  668. vals = vals + ',';
  669. }
  670. });
  671. dim.vals = vals;
  672. dim.filtertype = 2;
  673. delete dim.startmt;
  674. delete dim.endmt;
  675. delete dim.startdt;
  676. delete dim.enddt;
  677. }
  678. curTmpInfo.isupdate = true;
  679. chartview(comp, compId);
  680. $('#pdailog').dialog('close');
  681. }
  682. },{
  683. text:'取消',
  684. iconCls:"icon-cancel",
  685. handler:function(){
  686. $('#pdailog').dialog('close');
  687. }
  688. }]
  689. });
  690. var dimtp = dim.type;
  691. var curDim = dim;
  692. var filtertype = dim.filtertype == undefined ? "" : dim.filtertype;
  693. var url = "DimFilter.action?dsid="+comp.dsid+"&cubeId="+comp.cubeId+"&dimType="+dimtp+"&filtertype="+filtertype+"&id="+dimid;
  694. if(dimtp == 'month'){
  695. url = url + "&st="+(curDim.startmt == undefined ? "" : curDim.startmt);
  696. url = url + "&end="+(curDim.endmt == undefined ? "" : curDim.endmt);
  697. }
  698. if(dimtp == 'day'){
  699. url = url + "&st="+(curDim.startdt == undefined ? "" : curDim.startdt);
  700. url = url + "&end="+(curDim.enddt == undefined ? "" : curDim.enddt);
  701. url = url + "&dateformat=" + curDim.dateformat;
  702. }
  703. $("#pdailog #div_chartfilter").load(url, {vals:dim.vals?dim.vals:""});
  704. }
  705. function exchangexs(compId, islink){
  706. var comp = findCompById(compId);
  707. if(comp.chartJson == undefined || (comp.chartJson.xcol == undefined && comp.chartJson.scol == undefined)){
  708. msginfo("您还未选择维度。");
  709. }
  710. var tmp = comp.chartJson.xcol;
  711. comp.chartJson.xcol = comp.chartJson.scol;
  712. comp.chartJson.scol = tmp;
  713. //更新显示内容
  714. if(comp.chartJson.xcol && comp.chartJson.xcol.id){
  715. var node = comp.chartJson.xcol;
  716. $("#T" + compId + " #xcol").html("<span title=\""+(node.dimdesc ? node.dimdesc : "")+"\" class=\"charttxt\">" + (node.dimdesc ? node.dimdesc : "") + "</span><span class=\"charticon\" title=\"配置\" onclick=\"chartmenu(this, "+node.id+",'xcol', '"+node.dimdesc+"')\"></span>");
  717. }else{
  718. $("#T"+compId+" #xcol").html("<span class=\"charttip\">将维度拖到这里</span>");
  719. }
  720. if(comp.chartJson.scol && comp.chartJson.scol.id){
  721. var node = comp.chartJson.scol;
  722. $("#T" + compId + " #scol").html("<span title=\""+(node.dimdesc ? node.dimdesc : "")+"\" class=\"charttxt\">" + (node.dimdesc ? node.dimdesc : "") + "</span><span class=\"charticon\" title=\"配置\" onclick=\"chartmenu(this, "+node.id+",'scol', '"+node.dimdesc+"')\"></span>");
  723. }else{
  724. $("#T"+compId+" #scol").html("<span class=\"charttip\">将维度拖到这里</span>");
  725. }
  726. curTmpInfo.isupdate = true;
  727. chartview(comp, compId);
  728. //判断图表是否有联动
  729. if(comp.complink && islink){
  730. var tableComp = findCompById(comp.complink);
  731. if(tableComp != null && isSameDimsInDrill(tableComp, comp)){ //必须维度相同才能联动。
  732. curTmpInfo.compId = "T" + tableComp.id;
  733. changecolrow(false);
  734. }
  735. }
  736. }
  737. function crtChartfromTab(){
  738. var compId = curTmpInfo.compId.replace("T", "");
  739. var comp = findCompById(compId);
  740. var rows = "";
  741. for(i=0; i<comp.rows.length; i++){
  742. var selected = "";
  743. if(i == comp.rows.length - 1){
  744. selected = "selected";
  745. }
  746. rows = rows + "<option value='"+comp.rows[i].id+"' "+selected+">"+comp.rows[i].dimdesc+"</option>";
  747. }
  748. var cols = "";
  749. for(i=0; i<comp.cols.length; i++){
  750. var selected = "";
  751. if(i == comp.cols.length - 1){
  752. selected = "selected";
  753. }
  754. cols = cols + "<option value='"+comp.cols[i].id+"' "+selected+">"+comp.cols[i].dimdesc+"</option>";
  755. }
  756. var ctx = "<div style='line-height:25px; margin:10px;'><span class=\"inputtext\">类型:</span><select id='charttype' class=\"inputform2\"><option value='line'>曲线图</option><option value='column'>柱状图</option><option value='pie'>饼图</option><option value='radar'>雷达图</option></select><br><span class=\"inputtext\">横轴:</span><select id='hz' class=\"inputform2\">"+rows+"</select><br/><span class=\"inputtext\">图例:</span><select id='zz' class=\"inputform2\">"+cols+"</select></div>";
  757. $('#pdailog').dialog({
  758. title: '通过表格数据生成图表',
  759. width: 320,
  760. height: 220,
  761. closed: false,
  762. cache: false,
  763. modal: true,
  764. content:ctx,
  765. toolbar:null,
  766. buttons:[{
  767. text:'确定',
  768. iconCls:'icon-ok',
  769. handler:function(){
  770. var tp = $("#charttype").val();
  771. var xcol = $("#hz").val();
  772. var scol = $("#zz").val();
  773. var kpi = curTmpInfo.ckid;
  774. $('#pdailog').dialog('close');
  775. var chart = {id:2, name:"图表组件", type:"chart", chartJson:{type:tp,ycol:{type:"kpi"}, params:[]}, cubeId:comp.cubeId, tname:comp.tname, kpiJson:[], dsid:comp.dsid, dsetId:comp.dsetId, complink:comp.id}; //通过complink 实现图表和表格的联动
  776. comp.complink = chart.id; //设置表格和图表的联动
  777. //设置度量
  778. var k = eval("(" + JSON.stringify(findKpiById(kpi, comp.kpiJson)) + ")");
  779. chart.kpiJson.push(k);
  780. //设置y,ser
  781. if(xcol != null && xcol != ''){
  782. chart.chartJson.xcol = eval("(" + JSON.stringify(findDimById(xcol, comp.rows)) + ")");
  783. }
  784. if(scol != null && scol != ''){
  785. chart.chartJson.scol = eval("(" + JSON.stringify(findDimById(scol, comp.cols)) + ")");
  786. }
  787. //设置参数维
  788. for(k=0; k<comp.rows.length; k++){
  789. if(comp.rows[k].id == xcol || comp.rows[k].id == scol){
  790. }else{
  791. chart.chartJson.params.push(comp.rows[k]);
  792. }
  793. }
  794. for(k=0; k<comp.cols.length; k++){
  795. if(comp.cols[k].id == xcol || comp.cols[k].id == scol){
  796. }else{
  797. chart.chartJson.params.push(comp.cols[k]);
  798. }
  799. }
  800. curTmpInfo.isupdate = true;
  801. curTmpInfo.charttype = tp;
  802. addComp(chart.id, chart.name, null, false, chart.type, chart);
  803. //添加到组件
  804. pageInfo.comps[1] = chart;
  805. //切换选项卡
  806. $('a[data-toggle="tab"]').last().tab('show');
  807. }
  808. },{
  809. text:'取消',
  810. iconCls:"icon-cancel",
  811. handler:function(){
  812. $('#pdailog').dialog('close');
  813. }
  814. }]
  815. });
  816. }
  817. //导出图表到excel,次excel子包括数据,可以直接用来生成图表
  818. function exportChart(compId){
  819. var json = findCompById(compId);
  820. if(json.kpiJson == undefined || json.kpiJson.length == 0){
  821. return;
  822. }
  823. var params = "[]";
  824. if(pageInfo.params && pageInfo.params.length > 0){
  825. params = JSON.stringify(pageInfo.params);
  826. }
  827. var chartJson = JSON.stringify(json.chartJson);
  828. var kpiJson = JSON.stringify(json.kpiJson);
  829. var form = $("<form name='exp' method='post' action=\"ChartView!export.action\" id='exp'><input type='hidden' id='chartJson' name='chartJson'><input type='hidden' id='compId' name='compId'><input type='hidden' id='kpiJson' name='kpiJson'><input type='hidden' id='params' name='params'></form>");
  830. form.appendTo("body");
  831. form.find("#chartJson").val(chartJson);
  832. form.find("#compId").val(compId);
  833. form.find("#kpiJson").val(kpiJson);
  834. form.find("#params").val(params);
  835. form.submit();
  836. form.remove();
  837. }