RSUpgradePieChart.xsl 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: rspecupgrade
  5. (C) Copyright IBM Corp. 2005, 2010
  6. US Government Users Restricted Rights - Use, duplication or disclosure
  7. restricted by GSA ADP Schedule Contract with IBM Corp.
  8. -->
  9. <!-- COPYRIGHT_DATA { 'YEAR':[2005, 2009], 'RELEASE':['colorado_wave1'], 'VISIBLE':'YES', 'COMPONENT':'rspecupgrade' }-->
  10. <!--All lines above the COPYRIGHT_DATA line will be replaced when copyright notices are generated. -->
  11. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:baltic="http://developer.cognos.com/schemas/report/1/" xmlns="http://developer.cognos.com/schemas/report/2.0/" xmlns:date="http://exslt.org/dates-and-times" xmlns:exsl="http://exslt.org/common" xmlns:xalan="http://xml.apache.org/xalan" xmlns:java="http://xml.apache.org/xalan/java" extension-element-prefixes="xalan date exsl" exclude-result-prefixes="xalan java baltic date exsl">
  12. <xsl:template name="pieChartTemplate">
  13. <pieChart>
  14. <xsl:call-template name="depthTemplate"/>
  15. <xsl:call-template name="standardChartAttributesTemplate"/>
  16. <!-- ringHoleSize ==> holeSize -->
  17. <xsl:variable name="v_ringHoleSize" select="baltic:pieChart/@ringHoleSize"/>
  18. <xsl:if test="$v_ringHoleSize != ''">
  19. <xsl:attribute name="holeSize"><xsl:value-of select="$v_ringHoleSize"/></xsl:attribute>
  20. </xsl:if>
  21. <!-- showPieLabels ==> showPieLabels -->
  22. <xsl:variable name="v_showPieLabels" select="baltic:pieChart/@showPieLabels"/>
  23. <xsl:if test="$v_showPieLabels != '' and $v_showPieLabels != 'none'">
  24. <xsl:attribute name="showPieLabels"><xsl:choose><xsl:when test="$v_showPieLabels = 'onSlices'">inside</xsl:when><xsl:when test="$v_showPieLabels = 'outsideSlices'">outside</xsl:when><xsl:when test="$v_showPieLabels = 'outsideSlicesWithHeaderLines'">outsideWithLines</xsl:when></xsl:choose></xsl:attribute>
  25. </xsl:if>
  26. <!-- showPieValues ==> showPieValues -->
  27. <xsl:variable name="v_showPieValues" select="baltic:pieChart/@showPieValues"/>
  28. <xsl:if test="$v_showPieValues != '' and $v_showPieValues != 'none'">
  29. <xsl:attribute name="showPieValues"><xsl:choose><xsl:when test="$v_showPieValues = 'onSlices'">inside</xsl:when><xsl:when test="$v_showPieValues = 'outsideSlices'">outside</xsl:when><xsl:when test="$v_showPieValues = 'outsideSlicesWithHeaderLines'">outsideWithLines</xsl:when></xsl:choose></xsl:attribute>
  30. </xsl:if>
  31. <!-- showPercentage ==> showValuesAsPercent -->
  32. <xsl:variable name="v_showPercentage" select="baltic:pieChart/@showPercentage"/>
  33. <xsl:if test="$v_showPercentage != '' and $v_showPercentage != 'false'">
  34. <xsl:attribute name="showValuesAsPercent">true</xsl:attribute>
  35. </xsl:if>
  36. <!-- tooltips ==> showTooltips -->
  37. <xsl:variable name="v_tooltips" select="@tooltips"/>
  38. <xsl:if test="$v_tooltips != '' and $v_tooltips != 'false'">
  39. <xsl:attribute name="showTooltips">true</xsl:attribute>
  40. </xsl:if>
  41. <xsl:call-template name="generateMasterDetailLinks2">
  42. <xsl:with-param name="p_frame" select="."/>
  43. </xsl:call-template>
  44. <xsl:call-template name="legendTemplate"/>
  45. <xsl:variable name="v_ordinalAxis" select="baltic:axis[@axisPosition='X']"/>
  46. <xsl:call-template name="axisTitleTemplate">
  47. <xsl:with-param name="p_cur" select="$v_ordinalAxis"/>
  48. <xsl:with-param name="p_addAxisLine" select="'false'"/>
  49. </xsl:call-template>
  50. <!-- Baltic doesn't display pie labels if there's no category edge or if there's only 1 measure
  51. or if the chart only has measures -->
  52. <xsl:if test="$v_ordinalAxis/baltic:labels and (@rowEdgeIncluded != 'false' or count(baltic:chartMeasure) &gt; 1) and count(baltic:chartLevel) &gt; 0">
  53. <pieLabels>
  54. <xsl:call-template name="addStyle">
  55. <xsl:with-param name="for" select="'chartAxisLabel'"/>
  56. <xsl:with-param name="default" select="'true'"/>
  57. </xsl:call-template>
  58. <!-- attributes -->
  59. <xsl:if test="baltic:categoryItemTruncationText/baltic:text">
  60. <xsl:attribute name="truncationText"><xsl:value-of select="baltic:categoryItemTruncationText/baltic:text"/></xsl:attribute>
  61. </xsl:if>
  62. <xsl:if test="@categoryitemMaxCharacters">
  63. <xsl:attribute name="categoryitemMaxCharacters"><xsl:value-of select="@categoryitemMaxCharacters"/></xsl:attribute>
  64. </xsl:if>
  65. <xsl:if test="@itemEnableTruncation">
  66. <xsl:attribute name="categoryitemEnableTruncation"><xsl:value-of select="@categoryitemEnableTruncation"/></xsl:attribute>
  67. </xsl:if>
  68. <xsl:call-template name="simpleLayoutGroupTemplate">
  69. <xsl:with-param name="p_cur" select="$v_ordinalAxis/baltic:labels"/>
  70. </xsl:call-template>
  71. </pieLabels>
  72. </xsl:if>
  73. <xsl:variable name="v_pieSlices">
  74. <xsl:call-template name="chartLevelTemplate">
  75. <xsl:with-param name="p_mode" select="'columnEdge'"/>
  76. <xsl:with-param name="p_checkMeasures" select="'conditionally'"/>
  77. </xsl:call-template>
  78. </xsl:variable>
  79. <xsl:if test="$v_pieSlices/*">
  80. <pieSlices>
  81. <xsl:copy-of select="$v_pieSlices"/>
  82. </pieSlices>
  83. </xsl:if>
  84. <xsl:variable name="v_pies">
  85. <xsl:call-template name="chartLevelTemplate">
  86. <xsl:with-param name="p_mode" select="'rowEdge'"/>
  87. </xsl:call-template>
  88. </xsl:variable>
  89. <xsl:if test="$v_pies/*">
  90. <pies>
  91. <xsl:copy-of select="$v_pies"/>
  92. </pies>
  93. </xsl:if>
  94. <xsl:call-template name="defaultMeasureTemplate"/>
  95. <xsl:call-template name="commonChartTemplate"/>
  96. </pieChart>
  97. </xsl:template>
  98. </xsl:stylesheet>