123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- /****************************************************************
- ** Licensed Materials - Property of IBM
- **
- ** BI and PM: qs
- **
- ** (C) Copyright IBM Corp. 2001, 2015
- **
- ** US Government Users Restricted Rights - Use, duplication or
- ** disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- *****************************************************************/
- // Copyright (C) 2008 Cognos ULC, an IBM Company. All Rights Reserved.
- // Cognos and the Cognos logo are trademarks of Cognos ULC (formerly Cognos Incorporated) in the United States and/or other countries. IBM and the IBM logo are trademarks of International Business Machines Corporation in the United States, or other countries, or both. Other company, product, or service names may be trademarks or service marks of others.
- function CChart()
- {
- };
- CChart.prototype = new AFeatureObject();
- CChart.prototype.setup = function (aFeatureParams)
- {
- chartMore();
- };
- function canChartAsMeasure(index)
- {
- var oMQMgr = goApplicationManager.getMiniQueryManager();
- var summaryAgg = oMQMgr.getSummaryAggregate(index);
- if (summaryAgg == "count" && (oMQMgr.isMeasure(index) === false || oMQMgr.isFakeMeasure(index)))
- {
- return false;
- }
- if (summaryAgg == "default" || summaryAgg == "none")
- {
- var regularAgg = oMQMgr.getRegularAggregate(index);
- if (((regularAgg == "count" || regularAgg == "countDistinct") && (oMQMgr.isMeasure(index) === false || oMQMgr.isFakeMeasure(index))) || (regularAgg == "none" && (oMQMgr.getCalcOp(index) == "rank" || oMQMgr.isMeasure(index) === false)))
- {
- return false;
- }
- }
- return true;
- };
- function chartHelper()
- {
- var oMQMgr = goApplicationManager.getMiniQueryManager();
- var measureCount = 0;
- var nonMeasureCount = 0;
- var headerCount = 0;
- var i;
- var size = oMQMgr.getAllColumns().length;
- for (i = 0; i < size; i++)
- {
- if (oMQMgr.getHidden(i) == "none" && !oMQMgr.isReportExpression(i))
- {
- if (canChartAsMeasure(i))
- measureCount++;
- else if (oMQMgr.getColumnRole(i) === MINI_QUERY_GROUP_SECTION)
- headerCount++;
- else
- nonMeasureCount++;
- }
- }
- if (measureCount == 0)
- {
- cfgSet("LAST_DIALOG", "chart");
- dlgShowMessage("CHART_TITLE", "", "CHART_NEEDS_MEASURE");
- return "none";
- }
- if (nonMeasureCount == 0)
- {
- cfgSet("LAST_DIALOG", "chart");
- if (headerCount > 0)
- dlgShowMessage("CHART_TITLE", "", "CHART_NEEDS_NON_SECTION");
- else
- dlgShowMessage("CHART_TITLE", "", "CHART_NEEDS_NON_MEASURE");
- return "none";
- }
- return "all";
- };
- function chartMore()
- {
- var availableChart = chartHelper();
- if (availableChart == "none")
- return;
- cfgSet("LAST_DIALOG", "chart");
- dlgReset();
- dlgSetParm("m", "/" + qs_dir + "/chart.xts");
- var oChart = goApplicationManager.getMiniQueryManager().getChart();
- if (typeof oChart == "object")
- {
- if (oChart.getAttribute("type") !== null)
- {
- dlgSetParm("chartType", oChart.getAttribute("type"));
- }
- if (oChart.getAttribute("subType") !== null)
- {
- dlgSetParm("chartSubtype", oChart.getAttribute("subType"));
- }
- if (oChart.getAttribute("showValues") !== null)
- {
- dlgSetParm("showChartValues", oChart.getAttribute("showValues"));
- }
- if (oChart.getAttribute("showTable") !== null)
- {
- dlgSetParm("showTable", oChart.getAttribute("showTable"));
- }
- }
- dlgSubmit();
- };
- function submitChart(sChartType, sChartStyle, bShowTable, bShowChartValues)
- {
- var sCommand = createCommand("F", "C", new Array(sChartType, sChartStyle, bShowTable, bShowChartValues, "true"));
- sendCmd(sCommand, "", false);
- };
|