chart.xts 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. BI and PM: qs
  5. (C) Copyright IBM Corp. 2001, 2017
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. -->
  12. <xts:morphlet version="1.0" xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/QSRVUITextPL.xml,messages/portal.xml,messages/portalRL.xml" requiredCapability="canUseQueryStudio">
  13. <xts:block id="page" type="exec" mode="output" processor="XSLT" mimeType="text/html">
  14. <!-- get the debug logic sheet -->
  15. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  16. <!-- get the new theme stuff -->
  17. <xts:logicsheet path="logicsheets/portal.xsl"/>
  18. <xts:logicsheet path="qs/logicsheets/dialogs.xsl"/>
  19. <xts:logicsheet path="logicsheets/presentation/dialog/framework.xsl"/>
  20. <xts:logicsheet path="logicsheets/presentation/layout.xsl"/>
  21. <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
  22. <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
  23. <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
  24. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  25. <!-- apply the form logic -->
  26. <xts:logicsheet path="logicsheets/formlogic.xslt"/>
  27. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:lyt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/layout/" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/" xmlns:df="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/framework/" xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/" xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/" xmlns:dbg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/debug/" xmlns:qsdlg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/qs/dialog/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="xsl xts lyt pf dp df cp cf dbg qsdlg xtsext">
  28. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  29. <!-- add any theme variables -->
  30. <df:variables/>
  31. <pf:variables/>
  32. <xsl:key name="param-name" match="/root/env/param" use="@name"/>
  33. <!-- start the output -->
  34. <xsl:template match="/root">
  35. <xsl:variable name="chartType" select="key('param-name','chartType')"/>
  36. <xsl:variable name="chartSubtype" select="key('param-name','chartSubtype')"/>
  37. <xsl:variable name="showChartValues" select="key('param-name','showChartValues')"/>
  38. <xsl:variable name="showTable" select="key('param-name','showTable')"/>
  39. <dp:page>
  40. <dp:script>
  41. <script type="text/javascript">
  42. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/layout.js</xsl:attribute>
  43. <xsl:text/>//<xsl:text/>
  44. </script>
  45. <script type="text/javascript">
  46. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/classes/CDialogManager.js</xsl:attribute>
  47. <xsl:text/>//<xsl:text/>
  48. </script>
  49. <script type="text/javascript">&lt;!--
  50. var goDialogManager = new CDialogManager();
  51. var iconArray = new Array();
  52. for (var i=0; i &lt; 25; i++)
  53. iconArray[i] = new Image(48,48);
  54. var path = "<xsl:value-of select="$webRoot"/>/qs/images/chart/";
  55. iconArray[0].src = path + "area_standard.gif";
  56. iconArray[1].src = path + "area_stacked.gif";
  57. iconArray[2].src = path + "area_percent.gif";
  58. iconArray[3].src = path + "area_3d.gif";
  59. iconArray[4].src = path + "bar_standard.gif";
  60. iconArray[5].src = path + "bar_stacked.gif";
  61. iconArray[6].src = path + "bar_percent.gif";
  62. iconArray[7].src = path + "column_standard.gif";
  63. iconArray[8].src = path + "column_stacked.gif";
  64. iconArray[9].src = path + "column_percent.gif";
  65. iconArray[10].src = path + "column_3d.gif";
  66. iconArray[11].src = path + "line_standard.gif";
  67. iconArray[12].src = path + "line_stacked.gif";
  68. iconArray[13].src = path + "line_percent.gif";
  69. iconArray[14].src = path + "line_3d.gif";
  70. iconArray[15].src = path + "pie_flat.gif";
  71. iconArray[16].src = path + "pie_percent.gif";
  72. iconArray[17].src = path + "pie_3d.gif";
  73. iconArray[18].src = path + "radar_standard.gif";
  74. iconArray[19].src = path + "radar_stacked.gif";
  75. iconArray[20].src = path + "columnline_standard.gif";
  76. iconArray[21].src = path + "columnline_stacked.gif";
  77. iconArray[22].src = path + "columnline_percentage.gif";
  78. iconArray[23].src = path + "columnline_3d.gif";
  79. iconArray[24].src = path + "pie_percent_2d.gif";
  80. var chartMap = new Array();
  81. chartMap['_default'] = new Array();
  82. chartMap['_default'][1] = "standard";
  83. chartMap['_default'][3] = "stacked";
  84. chartMap['_default'][2] = "percent";
  85. chartMap['_default'][4] = "3DAxis";
  86. chartMap['pie'] = new Array();
  87. chartMap['pie'][1] = "standard";
  88. chartMap['pie'][3] = "3DAxis";
  89. chartMap['pie'][2] = "percent2D";
  90. chartMap['pie'][4] = "percent";
  91. function execute()
  92. {
  93. var cf = getConfigFrame();
  94. var style;
  95. for (var i = 0; i &lt; 4; i++)
  96. {
  97. if (document.f.chartStyle[i].checked)
  98. {
  99. style = document.f.chartStyle[i].value;
  100. break;
  101. }
  102. }
  103. var chart = (document.f.chartTypeRadio[0].checked) ? "table" : document.f.chartTypeSelect.value;
  104. var tempChart = chart;
  105. if (typeof chartMap[chart] == "undefined")
  106. tempChart = '_default';
  107. style = chartMap[tempChart][style];
  108. cf.addColumnsForReselection();
  109. cf.submitChart(chart,style,document.f.chartTable[0].checked,document.f.showChartValues.checked);
  110. }
  111. function init()
  112. {
  113. changeIcons(true);
  114. var chartType = document.f.chartTypeSelect.value;
  115. if (typeof chartMap[chartType] == "undefined")
  116. chartType = "_default";
  117. var subType = "<xsl:value-of select="xtsext:javascriptencode(string($chartSubtype))"/>";
  118. var i = 0;
  119. for (var j = 1; j &lt;= 4; j++)
  120. {
  121. if (chartMap[chartType][j] == subType)
  122. {
  123. if (j == 1)
  124. i = 0;
  125. else if (j == 2)
  126. i = 2;
  127. else if (j == 3)
  128. i = 1;
  129. else if (j == 4)
  130. i = 3;
  131. break;
  132. }
  133. }
  134. document.f.chartStyle[i].checked = true;
  135. attachMouseEvents();
  136. var cf=getConfigFrame?getConfigFrame():null;if (cf &amp;&amp; cf.showDialogFrame) cf.showDialogFrame(375);
  137. }
  138. function disableCtrls(bDisable)
  139. {
  140. document.f.showChartValues.disabled = bDisable;
  141. document.f.chartTable[0].disabled = bDisable;
  142. document.f.chartTable[1].disabled = bDisable;
  143. }
  144. function changeIcons(bInit)
  145. {
  146. if (!bInit)
  147. document.f.chartTypeRadio[1].checked= true;
  148. if (document.f.chartTypeSelect.value == "table")
  149. {
  150. document.f.chartTypeRadio[0].checked = true;
  151. disableCtrls(true);
  152. }
  153. else
  154. disableCtrls(false);
  155. if (document.f.chartTypeSelect.value == "bar")
  156. {
  157. document.f.image1.src = iconArray[4].src;
  158. document.f.image3.src = iconArray[5].src;
  159. document.f.image2.src = iconArray[6].src;
  160. }
  161. else if (document.f.chartTypeSelect.value == "column")
  162. {
  163. document.f.image1.src = iconArray[7].src;
  164. document.f.image3.src = iconArray[8].src;
  165. document.f.image2.src = iconArray[9].src;
  166. document.f.image4.src = iconArray[10].src;
  167. }
  168. else if (document.f.chartTypeSelect.value == "pie")
  169. {
  170. document.f.image1.src = iconArray[15].src;
  171. document.f.image3.src = iconArray[17].src;
  172. document.f.image2.src = iconArray[24].src;
  173. document.f.image4.src = iconArray[16].src;
  174. }
  175. else if (document.f.chartTypeSelect.value == "radar")
  176. {
  177. document.f.image1.src = iconArray[18].src;
  178. document.f.image3.src = iconArray[19].src;
  179. }
  180. else if (document.f.chartTypeSelect.value == "columnline")
  181. {
  182. document.f.image1.src = iconArray[20].src;
  183. document.f.image3.src = iconArray[21].src;
  184. document.f.image2.src = iconArray[22].src;
  185. document.f.image4.src = iconArray[23].src;
  186. }
  187. else if (document.f.chartTypeSelect.value == "line")
  188. {
  189. document.f.image1.src = iconArray[11].src;
  190. document.f.image3.src = iconArray[12].src;
  191. document.f.image2.src = iconArray[13].src;
  192. document.f.image4.src = iconArray[14].src;
  193. }
  194. else if (document.f.chartTypeSelect.value == "area3D")
  195. {
  196. document.f.image1.src = iconArray[0].src;
  197. document.f.image3.src = iconArray[1].src;
  198. document.f.image2.src = iconArray[2].src;
  199. document.f.image4.src = iconArray[3].src;
  200. }
  201. if (document.f.chartTypeSelect.value == "bar")
  202. {
  203. if (document.f.chartStyle[3].checked)
  204. document.f.chartStyle[0].checked = true;
  205. }
  206. else if (document.f.chartTypeSelect.value == "radar")
  207. {
  208. if (document.f.chartStyle[2].checked || document.f.chartStyle[3].checked)
  209. document.f.chartStyle[0].checked = true;
  210. }
  211. if (document.f.chartTypeSelect.value == "pie")
  212. {
  213. document.getElementById("style2").removeChild(document.getElementById("style2").firstChild);
  214. document.getElementById("style2").appendChild(document.createTextNode("<xts:string id="CHART_STYLE_PERCENT_PIE_2D" encode="javascript"/>"));
  215. document.getElementById("style3").removeChild(document.getElementById("style3").firstChild);
  216. document.getElementById("style3").appendChild(document.createTextNode("<xts:string id="CHART_STYLE_PIE_3D" encode="javascript"/>"));
  217. document.getElementById("style4").removeChild(document.getElementById("style4").firstChild);
  218. document.getElementById("style4").appendChild(document.createTextNode("<xts:string id="CHART_STYLE_PERCENT_PIE_3D" encode="javascript"/>"));
  219. }
  220. else
  221. {
  222. document.getElementById("style2").removeChild(document.getElementById("style2").firstChild);
  223. document.getElementById("style2").appendChild(document.createTextNode("<xts:string id="CHART_STYLE_PERCENTAGE" encode="javascript"/>"));
  224. document.getElementById("style3").removeChild(document.getElementById("style3").firstChild);
  225. if (document.f.chartTypeSelect.value == "radar")
  226. {
  227. document.getElementById("style3").appendChild(document.createTextNode("<xts:string id="CHART_STYLE_STACKED_AREA" encode="javascript"/>"));
  228. }
  229. else
  230. {
  231. document.getElementById("style3").appendChild(document.createTextNode("<xts:string id="CHART_STYLE_STACKED" encode="javascript"/>"));
  232. }
  233. document.getElementById("style4").removeChild(document.getElementById("style4").firstChild);
  234. if (document.f.chartTypeSelect.value == "columnline" || document.f.chartTypeSelect.value == "area3D")
  235. {
  236. document.getElementById("style4").appendChild(document.createTextNode("<xts:string id="CHART_STYLE_COLUMN_LINE_3D" encode="javascript"/>"));
  237. }
  238. else
  239. {
  240. document.getElementById("style4").appendChild(document.createTextNode("<xts:string id="CHART_STYLE_3D" encode="javascript"/>"));
  241. }
  242. }
  243. document.getElementById("span1").style.visibility = (document.f.chartTypeRadio[0].checked) ? "hidden": "visible";
  244. document.getElementById("span3").style.visibility = (document.f.chartTypeRadio[0].checked) ? "hidden": "visible";
  245. document.getElementById("span2").style.visibility = (document.f.chartTypeRadio[0].checked || document.f.chartTypeSelect.value == "radar") ? "hidden": "visible";
  246. document.getElementById("span4").style.visibility = (document.f.chartTypeRadio[0].checked || document.f.chartTypeSelect.value == "bar" || document.f.chartTypeSelect.value == "radar") ? "hidden": "visible";
  247. }
  248. //--&gt;</script>
  249. <script type="text/javascript">
  250. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/dialogs/executeButton.js</xsl:attribute>
  251. <xsl:text/>//<xsl:text/>
  252. </script>
  253. </dp:script>
  254. <form name="f" method="POST" onsubmit="return false;">
  255. <table border="0" cellspacing="0" cellpadding="0" height="100%" width="100%">
  256. <tr>
  257. <td width="100%" height="0%">
  258. <!-- dialog header -->
  259. <dp:header help="false">
  260. <!-- header titles -->
  261. <dp:title>
  262. <xts:string id="CHART_TITLE"/>
  263. </dp:title>
  264. <!-- close link for the header -->
  265. <dp:close>
  266. <a href="javascript:getConfigFrame().hideDialogFrame()">
  267. <dp:closeMarker/>
  268. </a>
  269. </dp:close>
  270. <!-- description (hint text) -->
  271. <dp:description>
  272. <xts:string id="CHART_DESCRIPTION"/>
  273. </dp:description>
  274. </dp:header>
  275. </td>
  276. </tr>
  277. <tr>
  278. <td width="100%" height="100%" valign="top">
  279. <!-- layout -->
  280. <lyt:layout style="2" border="no">
  281. <lyt:section>
  282. <dp:input>
  283. <dp:section1>
  284. <xts:string id="CHART_TYPE"/>
  285. </dp:section1>
  286. <dp:section2>
  287. <dp:choice>
  288. <dp:section1>
  289. <input name="chartTypeRadio" type="radio" value="table" onClick="disableCtrls(true);"/>
  290. </dp:section1>
  291. <dp:section2>
  292. <xts:string id="DIALOG_NONE"/>
  293. </dp:section2>
  294. <dp:section1>
  295. <input name="chartTypeRadio" type="radio" value="true" checked="" onClick="disableCtrls(false);">
  296. <xsl:if test="not( $chartType )">
  297. <xsl:attribute name="checked">true</xsl:attribute>
  298. </xsl:if>
  299. </input>
  300. </dp:section1>
  301. <dp:section2>
  302. <select name="chartTypeSelect" selectedParam="$chartType" onChange="changeIcons(false);">
  303. <qsdlg:option>
  304. <qsdlg:value>column</qsdlg:value>
  305. <qsdlg:label>CHART_TYPE_COLUMN</qsdlg:label>
  306. </qsdlg:option>
  307. <qsdlg:option>
  308. <qsdlg:value>bar</qsdlg:value>
  309. <qsdlg:label>CHART_TYPE_BAR</qsdlg:label>
  310. </qsdlg:option>
  311. <qsdlg:option>
  312. <qsdlg:value>pie</qsdlg:value>
  313. <qsdlg:label>CHART_TYPE_PIE</qsdlg:label>
  314. </qsdlg:option>
  315. <qsdlg:option>
  316. <qsdlg:value>line</qsdlg:value>
  317. <qsdlg:label>CHART_TYPE_LINE</qsdlg:label>
  318. </qsdlg:option>
  319. <qsdlg:option>
  320. <qsdlg:value>columnline</qsdlg:value>
  321. <qsdlg:label>CHART_TYPE_COLUMN_LINE</qsdlg:label>
  322. </qsdlg:option>
  323. <qsdlg:option>
  324. <qsdlg:value>area3D</qsdlg:value>
  325. <qsdlg:label>CHART_TYPE_AREA</qsdlg:label>
  326. </qsdlg:option>
  327. <qsdlg:option>
  328. <qsdlg:value>radar</qsdlg:value>
  329. <qsdlg:label>CHART_TYPE_RADAR</qsdlg:label>
  330. </qsdlg:option>
  331. </select>
  332. </dp:section2>
  333. <dp:section3>
  334. <div style="height:10px"/>
  335. <table border="0" cellspacing="0" cellpadding="3">
  336. <tr>
  337. <td width="125px" id="span1" style="visibility:hidden;">
  338. <table border="0" cellspacing="0" cellpadding="0">
  339. <tr>
  340. <td style="vertical-align:middle">
  341. <input type="radio" name="chartStyle" value="1" onClick="changeIcons(false);"/>
  342. </td>
  343. <td>
  344. <table border="0" cellspacing="0" cellpadding="0">
  345. <tr>
  346. <img name="image1">
  347. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/images/chart/column_standard.gif</xsl:attribute>
  348. </img>
  349. </tr>
  350. <tr>
  351. <td id="style1" class="formText">
  352. <xts:string id="CHART_STYLE_STANDARD"/>
  353. </td>
  354. </tr>
  355. </table>
  356. </td>
  357. </tr>
  358. </table>
  359. </td>
  360. <td width="125px" id="span3" style="visibility:hidden;">
  361. <table border="0" cellspacing="0" cellpadding="0">
  362. <tr>
  363. <td style="vertical-align:middle">
  364. <input type="radio" name="chartStyle" value="3" onClick="changeIcons(false);"/>
  365. </td>
  366. <td>
  367. <table border="0" cellspacing="0" cellpadding="0">
  368. <tr>
  369. <img name="image3">
  370. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/images/chart/column_percent.gif</xsl:attribute>
  371. </img>
  372. </tr>
  373. <tr>
  374. <td id="style3" class="formText">
  375. <xts:string id="CHART_STYLE_STACKED"/>
  376. </td>
  377. </tr>
  378. </table>
  379. </td>
  380. </tr>
  381. </table>
  382. </td>
  383. </tr>
  384. <tr>
  385. <td width="125px" id="span2" style="visibility:hidden;">
  386. <table border="0" cellspacing="0" cellpadding="0">
  387. <tr>
  388. <td style="vertical-align:middle">
  389. <input type="radio" name="chartStyle" value="2" onClick="changeIcons(false);"/>
  390. </td>
  391. <td>
  392. <table border="0" cellspacing="0" cellpadding="0">
  393. <tr>
  394. <img name="image2">
  395. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/images/chart/column_stacked.gif</xsl:attribute>
  396. </img>
  397. </tr>
  398. <tr>
  399. <td id="style2" class="formText">
  400. <xts:string id="CHART_STYLE_PERCENTAGE"/>
  401. </td>
  402. </tr>
  403. </table>
  404. </td>
  405. </tr>
  406. </table>
  407. </td>
  408. <td width="125px" id="span4" style="visibility:hidden;">
  409. <table border="0" cellspacing="0" cellpadding="0">
  410. <tr>
  411. <td style="vertical-align:middle">
  412. <input type="radio" name="chartStyle" value="4" onClick="changeIcons(false);"/>
  413. </td>
  414. <td>
  415. <table border="0" cellspacing="0" cellpadding="0">
  416. <tr>
  417. <img name="image4">
  418. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/images/chart/column_3d.gif</xsl:attribute>
  419. </img>
  420. </tr>
  421. <tr>
  422. <td id="style4" class="formText">
  423. <xts:string id="CHART_STYLE_3D"/>
  424. </td>
  425. </tr>
  426. </table>
  427. </td>
  428. </tr>
  429. </table>
  430. </td>
  431. </tr>
  432. </table>
  433. </dp:section3>
  434. </dp:choice>
  435. </dp:section2>
  436. </dp:input>
  437. </lyt:section>
  438. <lyt:section>
  439. <dp:choice>
  440. <dp:section1>
  441. <input name="showChartValues" type="checkbox" value="true">
  442. <xsl:if test="$showChartValues ='true'">
  443. <xsl:attribute name="checked">true</xsl:attribute>
  444. </xsl:if>
  445. </input>
  446. </dp:section1>
  447. <dp:section2>
  448. <xts:string id="CHART_SHOW_VALUES"/>
  449. </dp:section2>
  450. </dp:choice>
  451. <dp:choice title="CHART_SHOW_FOLLOWING">
  452. <dp:section1>
  453. <input type="radio" name="chartTable" value="true">
  454. <xsl:if test="not($showTable ='false')">
  455. <xsl:attribute name="checked">true</xsl:attribute>
  456. </xsl:if>
  457. </input>
  458. </dp:section1>
  459. <dp:section2>
  460. <xts:string id="CHART_AND_TABLE"/>
  461. </dp:section2>
  462. <dp:section1>
  463. <input type="radio" name="chartTable" value="false">
  464. <xsl:if test="$showTable ='false'">
  465. <xsl:attribute name="checked">true</xsl:attribute>
  466. </xsl:if>
  467. </input>
  468. </dp:section1>
  469. <dp:section2>
  470. <xts:string id="CHART_ONLY"/>
  471. </dp:section2>
  472. </dp:choice>
  473. </lyt:section>
  474. </lyt:layout>
  475. </td>
  476. </tr>
  477. <tr>
  478. <td width="100%" height="0%">
  479. <!-- Use default buttons [ OK = execute() and CANCEL = hideDialogFrame() ] -->
  480. <qsdlg:defaultButtons/>
  481. </td>
  482. </tr>
  483. <!-- <dbg:dumpxml select="/"/> -->
  484. </table>
  485. </form>
  486. </dp:page>
  487. </xsl:template>
  488. </xsl:stylesheet>
  489. </xts:block>
  490. </xts:morphlet>