// Licensed Materials - Property of IBM // // IBM Cognos Products: pps // // (C) Copyright IBM Corp. 2005, 2017 // // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. // This forms the javascript functions used for the display options // action pane for PowerPlay Studio. // The functions are Internet Explorer specific. var CHART_TYPE_PIE = 1; var CHART_TYPE_SIMPLEBAR = 2; var CHART_TYPE_CLUSTEREDBAR = 3; var CHART_TYPE_MULTILINE = 4; var CHART_TYPE_STACKEDBAR = 5; var CHART_TYPE_3DBAR = 6; var CHART_TYPE_SIMPLELINE = 10; var CHART_TYPE_SCATTERCHART = 11; var CHART_TYPE_CORRELATION = 12; var PERCENTAGE_SCREEN_MIN_VALUE = 10; var PERCENTAGE_SCREEN_MAX_VALUE = 500; var currentTab = 1; var chartOptionsComboBoxes = new Array(); var chartOptionComboBoxIds = new Array(); var chartOptionsSliders = new Array(); var fontArray = new Array(); var seriesArray = new Array(); function init() { topparent.openActionPane(); topparent.setActionPaneHeight("350"); ContextMenu.initialize(true,false); removeMessage(); if (!document.getElementById("tab1")) { displayCommonMessage(strErrorMessageNoChart, MESSAGE_TYPE_INFO, [strColorPickerOK], [function() {topparent.closeActionPane();}]); } else { initializeStatsPane(); initializePalettePane(); initializeLabelsPane(); storeOptionsUnderTag(document.body); initializeOptionValues(); initializePaletteControls(); intitializeBackgroundControls(); changeTolabel(0); chartDepthChanged(); switchToTab(parseInt(topparent.getGlobal("chartOptionsTab"))); topparent.setGlobal("chartOptionsTab",1); if (chartType == CHART_TYPE_PIE) pieLabelOptionsChanged(false); setTimeout("resize();",1); } } function initializePaletteControls() { if (chartType == CHART_TYPE_CORRELATION) { var colorControl = chartOptionValues["COPA_I1"].control; setPaletteSeriesItem(colorControl,"Palette1"); colorControl = chartOptionValues["COPA_I2"].control; setPaletteSeriesItem(colorControl,"Palette2"); } else if (chartOptionValues["COPA_I"]) { var colorControl = chartOptionValues["COPA_I"].control; setPaletteSeriesItem(colorControl,"Palette"); } else { populateSeriesDropDown(); updatePalettePreview(); paletteSeriesChanged(); } } function populateSeriesDropDown() { var currentPaletteSelect = document.getElementById("Palette_seriesSelect"); if (currentPaletteSelect) { var currentComboBox = initComboBox(currentPaletteSelect); var itemsArray = getSeriesArray(); var itemStr; for (var i = 0; i < 16; i++) { if (itemsArray != null && (i < itemsArray.length) && !(itemsArray[i].suppressed)) { itemStr = seriesLabel + " " + (i + 1) + " (" + itemsArray[i].name + ")"; } else { itemStr = seriesLabel + " " + (i + 1); } currentComboBox.addItem(new cbTextItem(itemStr, "paletteSeriesChanged();", (i == 0))); } chartOptionsComboBoxes["Palette_seriesSelect"] = currentComboBox; chartOptionComboBoxIds[chartOptionComboBoxIds.length] = "Palette_seriesSelect"; } } function getSeriesArray() { var itemsArray = null; //If there is no series array, then we return a blank array. As no series is passed in from the server. if (!seriesArray || !(seriesArray.length)) return new Array(); if (chartType == CHART_TYPE_PIE || chartType == CHART_TYPE_SCATTERCHART) { if (topparent.getChartFrame()) itemsArray = topparent.getChartFrame().legendDataList["c"]; else itemsArray = topparent.getXtabFrame().legendDataList["c"]; } else if (chartType != CHART_TYPE_CORRELATION) { if (topparent.getChartFrame()) itemsArray = topparent.getChartFrame().legendDataList["r"]; else itemsArray = topparent.getXtabFrame().legendDataList["r"]; } else { itemsArray = seriesArray; } return itemsArray; } function intitializeBackgroundControls() { var colorControl; if (chartType != CHART_TYPE_PIE) { colorControl = chartOptionValues["COB_B"].control; initializeGradientSelect("Background_gradientSelect","paletteColorChanged();"); setPaletteSeriesItem(colorControl,"Background"); } } function onOk() { applyOptions(true); } function onCancel() { topparent.clearActionPane(); } function onApply() { topparent.setGlobal("chartOptionsTab", currentTab); applyOptions(false); } function isStillCorrectChartType() { fh = topparent.getXtabFrame().document.fhidden; if (!fh) return false; var dType = fh.Y.value; if (fh.YS) dType = fh.YS.value; return (parseInt(dType) == chartType); } function applyOptions(closePane, skipValidation) { if (isStillCorrectChartType() && (skipValidation || validateFields(closePane))) { //Set the option values after the validation has been done setOptionValues(); var cmd = createCommand(); if (cmd != "") { cmd = "T:" + cmd; if (closePane) topparent.getXtabFrame().document.fhidden.ACTPANE.value = "0"; topparent.getXtabFrame().doit(cmd); } if (closePane) { topparent.clearActionPane(); } } } function switchTab(event) { var eventM = new eventManager(event); eventM.cancelBubble(); var newTab = eventM.getSrc(); var newTabNo = newTab.getAttribute("number"); switchToTab(newTabNo); } function switchToTab(newTabNo) { if (currentTab != newTabNo) { var newTab = document.getElementById("tab" + newTabNo); var oldTab = document.getElementById("tab" + currentTab); oldTab.className = "ActionPaneTab"; newTab.className = "ActionPaneSelectedTab"; var oldTabBody = document.getElementById("tab_body" + currentTab); oldTabBody.className = "ActionPaneTabBody"; var newTabBody = document.getElementById("tab_body" + newTabNo); newTabBody.className = "ActionPaneSelectedTabBody"; currentTab = newTabNo; if (currentTab == 1) { //General tab hideSliders(); } if (newTabNo == 1) { //General tab resetSliders(); } //Only necessary for gecko based browsers if (topparent.nn7) updatePalettePreview(); clearAllPopups(); } } function resize() { if (currentTab == 1) //General tab resetSliders(); } function initializeStatsPane() { initializeLineSelect("Min_line_type",""); initializeLineSelect("Max_line_type",""); initializeLineSelect("Mean_line_type",""); initializeLineSelect("Stddv_line_type",""); initializeLineSelect("logrg_line_type",""); initializeLineSelect("linrg_line_type",""); initializeLineSelect("cus_line_type",""); initializeSeriesSelect("Min_series",""); initializeSeriesSelect("Max_series",""); initializeSeriesSelect("Mean_series",""); initializeSeriesSelect("Stddv_series",""); initializeSeriesSelect("logrg_series",""); initializeSeriesSelect("linrg_series",""); initializeSeriesSelect("cus_series",""); } function initializePalettePane() { notifyColorChange = "paletteColorChanged();"; if (chartType != CHART_TYPE_CORRELATION) { initializeLineSelect("Palette_lineType","paletteColorChanged();"); initializeMarkerSelect("Palette_markerType","paletteColorChanged();"); } else { initializeLineSelect("Palette2_lineType","paletteColorChanged();"); initializeMarkerSelect("Palette2_markerType","paletteColorChanged();"); } } function initializeLabelsPane() { var chartLabelSelect = document.getElementById("labelSelect"); if (chartLabelSelect) { var currentComboBox = initComboBox(chartLabelSelect); addLabelOptionIfExists(currentComboBox, strLabelGraphTitle, "COL_GT", "labelSelectChanged();"); addLabelOptionIfExists(currentComboBox, strLabelVAxisTitle, "COL_VT", "labelSelectChanged();"); addLabelOptionIfExists(currentComboBox, strLabelVAxisTitle2, "COL_V2T", "labelSelectChanged();"); addLabelOptionIfExists(currentComboBox, strLabelHAxisTitle, "COL_HT", "labelSelectChanged();"); addLabelOptionIfExists(currentComboBox, strLabelVAxisLabels, "COL_VL", "labelSelectChanged();"); addLabelOptionIfExists(currentComboBox, strLabelVAxisLabels2, "COL_V2L", "labelSelectChanged();"); addLabelOptionIfExists(currentComboBox, strLabelHAxisLabels, "COL_HL", "labelSelectChanged();"); addLabelOptionIfExists(currentComboBox, strLabelValueLabels, "COL_VAL", "labelSelectChanged();"); addLabelOptionIfExists(currentComboBox, strLabelPieLabels, "COL_PL", "labelSelectChanged();"); addLabelOptionIfExists(currentComboBox, strLabelLegendLabels, "COL_LL", "labelSelectChanged();"); chartOptionsComboBoxes["labelSelect"] = currentComboBox; chartOptionComboBoxIds[chartOptionComboBoxIds.length] = "labelSelect"; } initializeFontSelect("label_font","currentLabelChanged();"); initializeFontSizeSelect("label_size","currentLabelChanged();"); if (fontArray.length <= 1) { document.getElementById("fontNameSelect").style.visibility = "hidden"; document.getElementById("fontNameLabel").style.visibility = "hidden"; } if (fontArray.length == 0) { document.getElementById("fontSizeSelect").style.visibility = "hidden"; document.getElementById("fontDecorationControls").style.visibility = "hidden"; document.getElementById("fontSizeLabel").style.visibility = "hidden"; document.getElementById("fontPreview").style.visibility = "hidden"; } setLabelPreviewImage(); } function addLabelOptionIfExists(combobox, str, name, action) { if (chartOptionValues[name]) { combobox.addItem(new cbTextItem(str, action, (combobox.numItems() == 0))); } } function paletteColorChanged() { var colorStoreDOMObj; if (chartType != CHART_TYPE_CORRELATION) { var single = true; if (chartOptionValues["COPA_I"]) { //Single color Palette; colorStoreDOMObj = chartOptionValues["COPA_I"].control; } else { single = false; colorStoreDOMObj = document.getElementById("chartPaletteSeriesHiddenStore").childNodes[chartOptionsComboBoxes["Palette_seriesSelect"].getSelectedItem()]; } if (chartType == CHART_TYPE_MULTILINE || chartType == CHART_TYPE_SIMPLELINE || chartType == CHART_TYPE_SCATTERCHART) { colorStoreDOMObj.setAttribute("lineColor",getColorPickerColor("Palette_color1")); if (chartOptionsComboBoxes["Palette_lineType"]) colorStoreDOMObj.setAttribute("lineType",(chartOptionsComboBoxes["Palette_lineType"].getSelectedItem())); colorStoreDOMObj.setAttribute("markerType",chartOptionsComboBoxes["Palette_markerType"].getSelectedItem()); if (chartType == CHART_TYPE_SCATTERCHART) { if (chartOptionsComboBoxes["Palette_markerType"].getSelectedItem() == 0) document.getElementById("Palette_colorComponent1").className="colorComponentHidden"; else document.getElementById("Palette_colorComponent1").className="colorComponentVisible"; } } else if (document.getElementById("Palette_colorTypeSolid").checked) { colorStoreDOMObj.setAttribute("solidColor",getColorPickerColor("Palette_color1")); } else if (document.getElementById("Palette_colorTypePattern").checked) { colorStoreDOMObj.setAttribute("patternColor1",getColorPickerColor("Palette_color1")); colorStoreDOMObj.setAttribute("patternColor2",getColorPickerColor("Palette_color2")); colorStoreDOMObj.setAttribute("pattern",parseInt(getPatternPickerPattern("Palette_pattern")) - 1); } else { colorStoreDOMObj.setAttribute("gradientColor1",getColorPickerColor("Palette_color1")); colorStoreDOMObj.setAttribute("gradientColor2",getColorPickerColor("Palette_color2")); } if (!single) { var itemNo = chartOptionsComboBoxes["Palette_seriesSelect"].getSelectedItem(); updatePalettePreviewItem(itemNo,itemNo + 1,"PalettePreview"); if (chartType == CHART_TYPE_SCATTERCHART) selectPalettePreviewItem(itemNo,"PalettePreview"); } } else { colorStoreDOMObj = chartOptionValues["COPA_I1"].control; if (document.getElementById("Palette1_colorTypeSolid").checked) { colorStoreDOMObj.setAttribute("solidColor",getColorPickerColor("Palette1_color1")); } else if (document.getElementById("Palette1_colorTypePattern").checked) { colorStoreDOMObj.setAttribute("patternColor1",getColorPickerColor("Palette1_color1")); colorStoreDOMObj.setAttribute("patternColor2",getColorPickerColor("Palette1_color2")); colorStoreDOMObj.setAttribute("pattern",parseInt(getPatternPickerPattern("Palette1_pattern")) - 1); } else { colorStoreDOMObj.setAttribute("gradientColor1",getColorPickerColor("Palette1_color1")); colorStoreDOMObj.setAttribute("gradientColor2",getColorPickerColor("Palette1_color2")); } colorStoreDOMObj = chartOptionValues["COPA_I2"].control; colorStoreDOMObj.setAttribute("lineColor",getColorPickerColor("Palette2_color1")); colorStoreDOMObj.setAttribute("lineType",chartOptionsComboBoxes["Palette2_lineType"].getSelectedItem()); colorStoreDOMObj.setAttribute("markerType",chartOptionsComboBoxes["Palette2_markerType"].getSelectedItem()); } //Update background var backControl; if (chartOptionValues["COB_B"]) backControl = chartOptionValues["COB_B"].control; if (document.getElementById("Background_colorTypeSolid")) { if (document.getElementById("Background_colorTypeSolid").checked) { backControl.setAttribute("solidColor",getColorPickerColor("Background_color1")); } else if (document.getElementById("Background_colorTypePattern").checked) { backControl.setAttribute("patternColor1",getColorPickerColor("Background_color1")); backControl.setAttribute("patternColor2",getColorPickerColor("Background_color2")); backControl.setAttribute("pattern",parseInt(getPatternPickerPattern("Background_pattern")) - 1); } else { backControl.setAttribute("gradientColor1",getColorPickerColor("Background_color1")); backControl.setAttribute("gradientColor2",getColorPickerColor("Background_color2")); backControl.setAttribute("gradientType",chartOptionsComboBoxes["Background_gradientSelect"].getSelectedItem()); } } currentLabelChanged(); } function updatePalettePreview() { if (!document.getElementById("Palette_seriesSelect")) return; if (document.getElementById("Palette_seriesSelect")) for (var i = 0; i < 16; i++) { updatePalettePreviewItem(i,(i+1),"PalettePreview"); } var currentSelection = 1; if (document.getElementById("Palette_seriesSelect")) currentSelection = chartOptionsComboBoxes["Palette_seriesSelect"].getSelectedItem(); selectPalettePreviewItem(currentSelection,"PalettePreview"); } function updatePalettePreviewItem(paletteItemNo, previewItemNo, prefix) { if (!document.getElementById(prefix + "_color1" + previewItemNo)) return; var colorControl = chartOptionValues["COPA_I" + (paletteItemNo + 1)].control; //Some browsers add the border around the width specified in Divs, we have to decrease this properly so that it fits if (document.getElementById(prefix + "_series" + previewItemNo)) resetWidthByBorderAmount(document.getElementById(prefix + "_series" + previewItemNo).firstChild,document.getElementById(prefix + "_series" + previewItemNo).offsetWidth); if (document.getElementById(prefix + "_color1" + previewItemNo)) resetWidthByBorderAmount(document.getElementById(prefix + "_color1" + previewItemNo).firstChild,document.getElementById(prefix + "_color1" + previewItemNo).offsetWidth); if (document.getElementById(prefix + "_color2" + previewItemNo)) resetWidthByBorderAmount(document.getElementById(prefix + "_color2" + previewItemNo).firstChild,document.getElementById(prefix + "_color1" + previewItemNo).offsetWidth); if (document.getElementById(prefix + "_line" + previewItemNo)) resetWidthByBorderAmount(document.getElementById(prefix + "_line" + previewItemNo).firstChild,document.getElementById(prefix + "_color1" + previewItemNo).offsetWidth); if (document.getElementById(prefix + "_marker" + previewItemNo)) resetWidthByBorderAmount(document.getElementById(prefix + "_marker" + previewItemNo).firstChild,document.getElementById(prefix + "_color1" + previewItemNo).offsetWidth); if (document.getElementById(prefix + "_pattern" + previewItemNo)) resetWidthByBorderAmount(document.getElementById(prefix + "_pattern" + previewItemNo).firstChild,document.getElementById(prefix + "_color1" + previewItemNo).offsetWidth); if (parseInt(colorControl.getAttribute("colorType")) == COLOR_TYPE_LINE) { if (chartType == CHART_TYPE_SCATTERCHART && parseInt(colorControl.getAttribute("markerType")) == 0) { document.getElementById(prefix + "_color1" + previewItemNo).firstChild.style.backgroundColor = "" document.getElementById(prefix + "_color1" + previewItemNo).setAttribute("on","false"); } else { document.getElementById(prefix + "_color1" + previewItemNo).firstChild.style.backgroundColor = "#" + colorControl.getAttribute("lineColor"); document.getElementById(prefix + "_color1" + previewItemNo).setAttribute("on","true"); } if (document.getElementById(prefix + "_line" + previewItemNo)) { document.getElementById(prefix + "_line" + previewItemNo).firstChild.style.backgroundImage = "url(" + topparent.getGlobal("menuImagePath") + "line" + (parseInt(colorControl.getAttribute("lineType")) + 1) + ".gif)"; document.getElementById(prefix + "_line" + previewItemNo).firstChild.style.backgroundPosition = "center"; document.getElementById(prefix + "_line" + previewItemNo).firstChild.style.backgroundColor = "#FFFFFF"; document.getElementById(prefix + "_line" + previewItemNo).setAttribute("on","true"); } document.getElementById(prefix + "_marker" + previewItemNo).firstChild.style.backgroundImage = "url(" + topparent.getGlobal("menuImagePath") + "marker" + colorControl.getAttribute("markerType") + ".gif)"; document.getElementById(prefix + "_marker" + previewItemNo).firstChild.style.backgroundPosition = "center"; document.getElementById(prefix + "_marker" + previewItemNo).firstChild.style.backgroundColor = "#FFFFFF"; document.getElementById(prefix + "_marker" + previewItemNo).setAttribute("on","true"); } else if (parseInt(colorControl.getAttribute("colorType")) == COLOR_TYPE_SOLID) { document.getElementById(prefix + "_color1" + previewItemNo).firstChild.style.backgroundColor = "#" + colorControl.getAttribute("solidColor"); document.getElementById(prefix + "_color1" + previewItemNo).setAttribute("on","true"); if (document.getElementById(prefix + "_color2" + previewItemNo)) { document.getElementById(prefix + "_color2" + previewItemNo).firstChild.style.backgroundColor = ""; document.getElementById(prefix + "_color2" + previewItemNo).setAttribute("on","false"); } if (document.getElementById(prefix + "_pattern" + previewItemNo)) { document.getElementById(prefix + "_pattern" + previewItemNo).firstChild.style.backgroundImage = ""; document.getElementById(prefix + "_pattern" + previewItemNo).setAttribute("on","false"); } } else if (parseInt(colorControl.getAttribute("colorType")) == COLOR_TYPE_PATTERN) { document.getElementById(prefix + "_color1" + previewItemNo).firstChild.style.backgroundColor = "#" + colorControl.getAttribute("patternColor1"); document.getElementById(prefix + "_color1" + previewItemNo).setAttribute("on","true"); if (document.getElementById(prefix + "_color2" + previewItemNo)) { document.getElementById(prefix + "_color2" + previewItemNo).firstChild.style.backgroundColor = "#" + colorControl.getAttribute("patternColor2"); document.getElementById(prefix + "_color2" + previewItemNo).setAttribute("on","true"); } if (document.getElementById(prefix + "_pattern" + previewItemNo)) { document.getElementById(prefix + "_pattern" + previewItemNo).firstChild.style.backgroundImage = getPatternStyle(parseInt(colorControl.getAttribute("pattern")) + 1); document.getElementById(prefix + "_pattern" + previewItemNo).setAttribute("on","true"); } } else { document.getElementById(prefix + "_color1" + previewItemNo).firstChild.style.backgroundColor = "#" + colorControl.getAttribute("gradientColor1"); document.getElementById(prefix + "_color1" + previewItemNo).setAttribute("on","true"); if (document.getElementById(prefix + "_color2" + previewItemNo)) { document.getElementById(prefix + "_color2" + previewItemNo).firstChild.style.backgroundColor = "#" + colorControl.getAttribute("gradientColor2"); document.getElementById(prefix + "_color2" + previewItemNo).setAttribute("on","true"); } if (document.getElementById(prefix + "_pattern" + previewItemNo)) { document.getElementById(prefix + "_pattern" + previewItemNo).firstChild.style.backgroundImage = ""; document.getElementById(prefix + "_pattern" + previewItemNo).setAttribute("on","false"); } } } function selectPalettePreviewItem(itemNo,prefix) { if (!document.getElementById(prefix + "_color11")) return; var colorControl = chartOptionValues["COPA_I" + (itemNo + 1)].control var numPreviewItems = 1; if (document.getElementById("Palette_seriesSelect")) numPreviewItems = 16; for (var i = 0; i < numPreviewItems; i++) { if (i == itemNo) { if (document.getElementById(prefix + "_series" + (i + 1) + "div")) document.getElementById(prefix + "_series" + (i + 1) + "div").className = "palettePreviewCellDivSelected ChartOptionsLabel"; if (!document.getElementById(prefix + "_marker" + (i + 1) + "div") || document.getElementById(prefix + "_line" + (i + 1) + "div") || chartOptionsComboBoxes["Palette_markerType"].getSelectedItem() != 0) document.getElementById(prefix + "_color1" + (i + 1) + "div").className = "palettePreviewCellDivSelected"; else document.getElementById(prefix + "_color1" + (i + 1) + "div").className = "palettePreviewCellDiv"; if (document.getElementById(prefix + "_line" + (i + 1) + "div")) if (colorControl.getAttribute("colorType") == COLOR_TYPE_LINE) document.getElementById(prefix + "_line" + (i + 1) + "div").className = "palettePreviewCellDivSelected"; else document.getElementById(prefix + "_line" + (i + 1) + "div").className = "palettePreviewCellDiv"; if (document.getElementById(prefix + "_marker" + (i + 1) + "div")) if (colorControl.getAttribute("colorType") == COLOR_TYPE_LINE) document.getElementById(prefix + "_marker" + (i + 1) + "div").className = "palettePreviewCellDivSelected"; else document.getElementById(prefix + "_marker" + (i + 1) + "div").className = "palettePreviewCellDiv"; if (document.getElementById(prefix + "_color2" + (i + 1) + "div")) if (colorControl.getAttribute("colorType") == COLOR_TYPE_PATTERN || colorControl.getAttribute("colorType") == COLOR_TYPE_GRADIENT) document.getElementById(prefix + "_color2" + (i + 1) + "div").className = "palettePreviewCellDivSelected"; else document.getElementById(prefix + "_color2" + (i + 1) + "div").className = "palettePreviewCellDiv"; if (document.getElementById(prefix + "_pattern" + (i + 1) + "div")) if (colorControl.getAttribute("colorType") == COLOR_TYPE_PATTERN) document.getElementById(prefix + "_pattern" + (i + 1) + "div").className = "palettePreviewCellDivSelected"; else document.getElementById(prefix + "_pattern" + (i + 1) + "div").className = "palettePreviewCellDiv"; } else { document.getElementById(prefix + "_color1" + (i + 1) + "div").className = "palettePreviewCellDiv"; document.getElementById(prefix + "_series" + (i + 1) + "div").className = "palettePreviewCellDiv ChartOptionsLabel"; if (document.getElementById(prefix + "_color2" + (i + 1) + "div")) document.getElementById(prefix + "_color2" + (i + 1) + "div").className = "palettePreviewCellDiv"; if (document.getElementById(prefix + "_pattern" + (i + 1) + "div")) document.getElementById(prefix + "_pattern" + (i + 1) + "div").className = "palettePreviewCellDiv"; if (document.getElementById(prefix + "_line" + (i + 1) + "div")) document.getElementById(prefix + "_line" + (i + 1) + "div").className = "palettePreviewCellDiv"; if (document.getElementById(prefix + "_marker" + (i + 1) + "div")) document.getElementById(prefix + "_marker" + (i + 1) + "div").className = "palettePreviewCellDiv"; } } } function setLabelPreviewImage() { var image = document.getElementById("labelPreviewImage"); var imageName = "col"; if (chartType == CHART_TYPE_SIMPLEBAR || chartType == CHART_TYPE_CLUSTEREDBAR || chartType == CHART_TYPE_STACKEDBAR || chartType == CHART_TYPE_3DBAR) { var horizontal = false; if (chartOptionValues["COGCB_H"]) { if (chartOptionValues["COGCB_H"].control) { if (chartOptionValues["COGCB_H"].control.checked) horizontal = true; } else if (chartOptionValues["COGCB_H"].details.value) horizontal = true; } if (horizontal) imageName += "horz"; imageName += "bar"; } else if (chartType == CHART_TYPE_MULTILINE || chartType == CHART_TYPE_SIMPLELINE) { imageName += "line"; } else if (chartType == CHART_TYPE_PIE) { imageName += "pie"; } else if (chartType == CHART_TYPE_SCATTERCHART) { imageName += "scatter"; } else if (chartType == CHART_TYPE_CORRELATION) { imageName += "corr"; } var options = document.getElementById("labelOptionsHiddenStore"); var option = options.childNodes[chartOptionsComboBoxes["labelSelect"].getSelectedItem()]; var optionName = option.getAttribute("optionName"); if (optionName == "COL_GT") imageName += "title"; else if (optionName == "COL_VT") if (chartType == CHART_TYPE_CORRELATION || chartType == CHART_TYPE_SCATTERCHART) imageName += "measure1title"; else imageName += "measuretitle"; else if (optionName == "COL_V2T") imageName += "measure2title"; else if (optionName == "COL_HT") if (chartType == CHART_TYPE_SCATTERCHART) imageName += "measure2title"; else imageName += "cattitle"; else if (optionName == "COL_VL") if (chartType == CHART_TYPE_CORRELATION || chartType == CHART_TYPE_SCATTERCHART) imageName += "measure1labels"; else imageName += "measurelabels"; else if (optionName == "COL_V2L") imageName += "measure2labels"; else if (optionName == "COL_HL") if (chartType == CHART_TYPE_SCATTERCHART) imageName += "measure2labels"; else imageName += "catlabels"; else if (optionName == "COL_PL") imageName += "catlabels"; else if (optionName == "COL_VAL") imageName += "valuelabels"; else if (optionName == "COL_LL") imageName += "legendlabels"; var imagePath = genericIconPath + imageName + ".png"; document.getElementById("labelPreviewImage").src = imagePath; } function paletteSeriesChanged() { if (!document.getElementById("Palette_seriesSelect")) return; var colorControl = document.getElementById("chartPaletteSeriesHiddenStore").childNodes[chartOptionsComboBoxes["Palette_seriesSelect"].getSelectedItem()]; setPaletteSeriesItem(colorControl,"Palette"); selectPalettePreviewItem(chartOptionsComboBoxes["Palette_seriesSelect"].getSelectedItem(),"PalettePreview"); } function setPaletteSeriesItem(colorControl,prefix) { if (document.getElementById(prefix + "_colorTypeSolid") && parseInt(colorControl.getAttribute("colorType")) == COLOR_TYPE_SOLID) { document.getElementById(prefix + "_colorTypeSolid").checked = true; document.getElementById(prefix + "_colorTypePattern").checked = false; document.getElementById(prefix + "_colorTypeGradient").checked = false; } else if (document.getElementById(prefix + "_colorTypePattern") && parseInt(colorControl.getAttribute("colorType")) == COLOR_TYPE_PATTERN) { document.getElementById(prefix + "_colorTypeSolid").checked = false; document.getElementById(prefix + "_colorTypePattern").checked = true; document.getElementById(prefix + "_colorTypeGradient").checked = false; } else if (document.getElementById(prefix + "_colorTypeGradient")) { document.getElementById(prefix + "_colorTypeSolid").checked = false; document.getElementById(prefix + "_colorTypePattern").checked = false; document.getElementById(prefix + "_colorTypeGradient").checked = true; } if (document.getElementById(prefix + "_seriesSelect")) setColorType(chartOptionsComboBoxes["Palette_seriesSelect"].getSelectedItem() + 1, prefix); else setColorType(0,prefix); } function initializeLineSelect(comboBoxId,action) { var currentLineSelect = document.getElementById(comboBoxId); if (currentLineSelect) { var currentComboBox = initComboBox(currentLineSelect); numLines = 5; for (var i = 1; i <= numLines; i++) currentComboBox.addItem(new cbRepeatingImageItem(topparent.getGlobal("menuImagePath") + "line" + i + ".gif",action,(i == 1))); chartOptionsComboBoxes[comboBoxId] = currentComboBox; chartOptionComboBoxIds[chartOptionComboBoxIds.length] = comboBoxId; } } function initializeMarkerSelect(comboBoxId,action) { var currentMarkerSelect = document.getElementById(comboBoxId); if (currentMarkerSelect) { var currentComboBox = initComboBox(currentMarkerSelect); numLines = 8; for (var i = 0; i < numLines; i++) currentComboBox.addItem(new cbRepeatingImageItem(topparent.getGlobal("menuImagePath") + "marker" + i + ".gif",action,(i == 1))); chartOptionsComboBoxes[comboBoxId] = currentComboBox; chartOptionComboBoxIds[chartOptionComboBoxIds.length] = comboBoxId; } } function initializeFontSelect(comboBoxId,action) { var currentFontSelect = document.getElementById(comboBoxId); if (currentFontSelect) { var currentComboBox = initComboBox(currentFontSelect); for (var i = 0; i < fontArray.length; i++) currentComboBox.addItem(new cbTextItem(fontArray[i].name, action, (i == 0))); chartOptionsComboBoxes[comboBoxId] = currentComboBox; chartOptionComboBoxIds[chartOptionComboBoxIds.length] = comboBoxId; } } function initializeFontSizeSelect(comboBoxId,action) { var currentFontSizeSelect = document.getElementById(comboBoxId); if (currentFontSizeSelect) { var currentComboBox = initComboBox(currentFontSizeSelect); currentComboBox.addItem(new cbTextItem(strDefault, action, false)); currentComboBox.addItem(new cbTextItem("4", action, false)); currentComboBox.addItem(new cbTextItem("6", action, false)); currentComboBox.addItem(new cbTextItem("7", action, false)); currentComboBox.addItem(new cbTextItem("8", action, false)); currentComboBox.addItem(new cbTextItem("9", action, false)); currentComboBox.addItem(new cbTextItem("10", action, true)); currentComboBox.addItem(new cbTextItem("11", action, true)); currentComboBox.addItem(new cbTextItem("12", action, false)); currentComboBox.addItem(new cbTextItem("13", action, false)); currentComboBox.addItem(new cbTextItem("14", action, false)); currentComboBox.addItem(new cbTextItem("15", action, false)); currentComboBox.addItem(new cbTextItem("16", action, false)); currentComboBox.addItem(new cbTextItem("18", action, false)); currentComboBox.addItem(new cbTextItem("20", action, false)); chartOptionsComboBoxes[comboBoxId] = currentComboBox; chartOptionComboBoxIds[chartOptionComboBoxIds.length] = comboBoxId; } } function initializeSeriesSelect(comboBoxId,action) { var currentSeriesSelect = document.getElementById(comboBoxId); if (currentSeriesSelect) { var currentComboBox = initComboBox(currentSeriesSelect); var itemsArray = getSeriesArray(); for (var i = 0; i < itemsArray.length; i++) currentComboBox.addItem(new cbTextItem(itemsArray[i].name, action, (i == 0))); chartOptionsComboBoxes[comboBoxId] = currentComboBox; chartOptionComboBoxIds[chartOptionComboBoxIds.length] = comboBoxId; } } function initializeGradientSelect(comboBoxId,action) { var currentSeriesSelect = document.getElementById(comboBoxId); if (currentSeriesSelect) { var currentComboBox = initComboBox(currentSeriesSelect); currentComboBox.addItem(new cbImageTextItem(strUp, genericIconPath + "gradup.png", action, true)); currentComboBox.addItem(new cbImageTextItem(strLeft, genericIconPath + "gradleft.png", action, false)); currentComboBox.addItem(new cbImageTextItem(strRight, genericIconPath + "gradright.png", action, false)); currentComboBox.addItem(new cbImageTextItem(strDown, genericIconPath + "graddown.png", action, false)); chartOptionsComboBoxes[comboBoxId] = currentComboBox; chartOptionComboBoxIds[chartOptionComboBoxIds.length] = comboBoxId; } } function clearAllPopups() { for (var i = 0; i < chartOptionComboBoxIds.length; i++) { chartOptionsComboBoxes[chartOptionComboBoxIds[i]].hideDropDown(); } hideColorPicker(); } function colorTypeChange(event, idPrefix) { var itemNo = 1; if (idPrefix == "Palette" && document.getElementById("Palette_seriesSelect")) itemNo = parseInt(chartOptionsComboBoxes["Palette_seriesSelect"].getSelectedItem()) + 1; setColorType(itemNo, idPrefix); } function setColorType(itemNo, idPrefix) { var colorControl; if (idPrefix == "Background") colorControl = chartOptionValues["COB_B"].control; else if (document.getElementById("Palette_seriesSelect")) colorControl = chartOptionValues["COPA_I" + itemNo].control; else if (chartType == CHART_TYPE_CORRELATION) { if (idPrefix == "Palette1") colorControl = chartOptionValues["COPA_I1"].control; else colorControl = chartOptionValues["COPA_I2"].control; } else colorControl = chartOptionValues["COPA_I"].control; if (parseInt(colorControl.getAttribute("colorType")) == COLOR_TYPE_LINE) { setColorPicker(idPrefix + "_color1",colorControl.getAttribute("lineColor")); if (chartOptionsComboBoxes[idPrefix + "_lineType"]) chartOptionsComboBoxes[idPrefix + "_lineType"].setSelectedItem(parseInt(colorControl.getAttribute("lineType"))); chartOptionsComboBoxes[idPrefix + "_markerType"].setSelectedItem(parseInt(colorControl.getAttribute("markerType"))); if (chartType == CHART_TYPE_SCATTERCHART) { if (chartOptionsComboBoxes[idPrefix + "_markerType"].getSelectedItem() == 0) document.getElementById(idPrefix + "_colorComponent1").className="colorComponentHidden"; else document.getElementById(idPrefix + "_colorComponent1").className="colorComponentVisible"; } } else if (!document.getElementById(idPrefix + "_colorTypeSolid") || document.getElementById(idPrefix + "_colorTypeSolid").checked) { colorControl.setAttribute("colorType",COLOR_TYPE_SOLID); setColorPicker(idPrefix + "_color1",colorControl.getAttribute("solidColor")); if (idPrefix == "Background"/* || idPrefix == "LBackground" || idPrefix == "RBackground" || idPrefix == "Floor"*/) { document.getElementById(idPrefix + "_gradientType").className = "colorComponentHidden"; } if (document.getElementById(idPrefix + "_colorTypeSolid")) { document.getElementById(idPrefix + "_colorComponent1").className="colorComponentVisible"; document.getElementById(idPrefix + "_colorComponent2").className="colorComponentHidden"; document.getElementById(idPrefix + "_patternComponent").className="colorComponentHidden"; document.getElementById(idPrefix + "_colorComponent1Label").removeChild(document.getElementById(idPrefix + "_colorComponent1Label").firstChild); document.getElementById(idPrefix + "_colorComponent1Label").appendChild(document.createTextNode(strColor)); } } else if (document.getElementById(idPrefix + "_colorTypePattern") && document.getElementById(idPrefix + "_colorTypePattern").checked) { colorControl.setAttribute("colorType",COLOR_TYPE_PATTERN); setColorPicker(idPrefix + "_color1",colorControl.getAttribute("patternColor1")); setColorPicker(idPrefix + "_color2",colorControl.getAttribute("patternColor2")); setPatternPicker(idPrefix + "_pattern",parseInt(colorControl.getAttribute("pattern")) + 1); if (idPrefix == "Background"/* || idPrefix == "LBackground" || idPrefix == "RBackground" || idPrefix == "Floor"*/) { document.getElementById(idPrefix + "_gradientType").className = "colorComponentHidden"; } document.getElementById(idPrefix + "_colorComponent1").className="colorComponentVisible"; document.getElementById(idPrefix + "_colorComponent2").className="colorComponentVisible"; document.getElementById(idPrefix + "_patternComponent").className="colorComponentVisible"; document.getElementById(idPrefix + "_colorComponent1Label").removeChild(document.getElementById(idPrefix + "_colorComponent1Label").firstChild); document.getElementById(idPrefix + "_colorComponent1Label").appendChild(document.createTextNode(strForegroundColor)); document.getElementById(idPrefix + "_colorComponent2Label").removeChild(document.getElementById(idPrefix + "_colorComponent2Label").firstChild); document.getElementById(idPrefix + "_colorComponent2Label").appendChild(document.createTextNode(strBackgroundColor)); } else if (document.getElementById(idPrefix + "_colorTypeGradient")) { colorControl.setAttribute("colorType",COLOR_TYPE_GRADIENT); setColorPicker(idPrefix + "_color1",colorControl.getAttribute("gradientColor1")); setColorPicker(idPrefix + "_color2",colorControl.getAttribute("gradientColor2")); if (idPrefix == "Background"/* || idPrefix == "LBackground" || idPrefix == "RBackground" || idPrefix == "Floor"*/) { document.getElementById(idPrefix + "_gradientType").className = "colorComponentVisible"; chartOptionsComboBoxes[idPrefix + "_gradientSelect"].setSelectedItem(parseInt(colorControl.getAttribute("gradientType"))); } document.getElementById(idPrefix + "_colorComponent1").className="colorComponentVisible"; document.getElementById(idPrefix + "_colorComponent2").className="colorComponentVisible"; document.getElementById(idPrefix + "_patternComponent").className="colorComponentHidden"; document.getElementById(idPrefix + "_colorComponent1Label").removeChild(document.getElementById(idPrefix + "_colorComponent1Label").firstChild); document.getElementById(idPrefix + "_colorComponent1Label").appendChild(document.createTextNode(strColor1)); document.getElementById(idPrefix + "_colorComponent2Label").removeChild(document.getElementById(idPrefix + "_colorComponent2Label").firstChild); document.getElementById(idPrefix + "_colorComponent2Label").appendChild(document.createTextNode(strColor2)); } if (document.getElementById("Palette_seriesSelect") && idPrefix == "Palette") { updatePalettePreviewItem(itemNo - 1,itemNo,"PalettePreview"); selectPalettePreviewItem(itemNo - 1,"PalettePreview"); } } function selectPaletteItemNo(event, itemNo) { var eventM = new eventManager(event); eventM.cancelBubble(); if (document.getElementById("Palette_seriesSelect")) chartOptionsComboBoxes["Palette_seriesSelect"].setSelectedItem((itemNo - 1)); paletteSeriesChanged(); } function dblClickPaletteItemNo(event, cpId, type) { var eventM = new eventManager(event); eventM.cancelBubble(); if (eventM.getSrc().getAttribute("on") != "false") if (type =="color") { displayColorPickerObj(document.getElementById(cpId)); } else { displayPatternPickerObj(document.getElementById(cpId)); } } function fontButtonClicked(event) { var eventM = new eventManager(event); eventM.cancelBubble(); var button = eventM.getSrc(); toggleButton(button); } function toggleButton(button) { if (button.getAttribute("isdisabled") == "true") return; if (button.getAttribute("pressed") == "true") { setButtonState(button,false); } else { setButtonState(button,true); } } function setButtonState(button,pressed) { if (pressed) { button.className = "chartOptionsFontButtonPressed"; button.setAttribute("pressed","true"); } else { button.className = "chartOptionsFontButton"; button.setAttribute("pressed","false"); } } function rolloverbutton(button) { if (button.getAttribute("isdisabled") == "true") return; if (button.getAttribute("pressed") == "true") { button.className = "chartOptionsFontButtonRolloverPressed"; } else { button.className = "chartOptionsFontButtonRollover"; } } function rolloutbutton(button) { if (button.getAttribute("isdisabled") == "true") return; if (button.getAttribute("pressed") == "true") { button.className = "chartOptionsFontButtonPressed"; } else { button.className = "chartOptionsFontButton"; } } function labelSelectChanged() { changeTolabel(chartOptionsComboBoxes["labelSelect"].getSelectedItem()); } function changeTolabel(labelNo) { var option = document.getElementById("labelOptionsHiddenStore").childNodes[labelNo]; if (chartOptionValues[option.getAttribute("optionName")].details.type == CHART_OPTION_VALUE_TITLE) { document.getElementById("label_text").parentNode.style.visibility = "visible"; document.getElementById("label_isDefault").parentNode.style.visibility = "visible"; document.getElementById("label_text").value = option.getAttribute("title"); if (option.getAttribute("isdefault") == "true") document.getElementById("label_isDefault").checked = true; else document.getElementById("label_notDefault").checked = true; } else { document.getElementById("label_isDefault").parentNode.style.visibility = "hidden"; document.getElementById("label_text").parentNode.style.visibility = "hidden"; } setButtonState(document.getElementById("label_bold"),option.getAttribute("bold") == "true"); setButtonState(document.getElementById("label_italic"),option.getAttribute("italic") == "true"); setButtonState(document.getElementById("label_underlined"),option.getAttribute("underline") == "true"); var selectedItem = 0; for (var i = 0; (i < chartOptionsComboBoxes["label_font"].numItems()) && (selectedItem == 0); i++) { if (chartOptionsComboBoxes["label_font"].getItem(i).text == option.getAttribute("font")) selectedItem = i; } if (chartOptionsComboBoxes["label_font"].numItems()) chartOptionsComboBoxes["label_font"].setSelectedItem(selectedItem); var fontSizeItem = 0; switch (parseInt(option.getAttribute("fontSize"))) { case 0: fontSizeItem = 0; break; case 4: fontSizeItem = 1; break; case 6: fontSizeItem = 2; break; case 7: fontSizeItem = 3; break; case 8: fontSizeItem = 4; break; case 9: fontSizeItem = 5; break; case 10: fontSizeItem = 6; break; case 11: fontSizeItem = 7; break; case 12: fontSizeItem = 8; break; case 13: fontSizeItem = 9; break; case 14: fontSizeItem = 10; break; case 15: fontSizeItem = 11; break; case 16: fontSizeItem = 12; break; case 18: fontSizeItem = 13; break; case 20: fontSizeItem = 14; break; } chartOptionsComboBoxes["label_size"].setSelectedItem(fontSizeItem); setColorPicker("label_color",option.getAttribute("color")); if(fontArray.length) updateFontOptsButtons(); updateLabelPreview(); if (option.getAttribute("optionName") == "COL_HL") { //Only if this is the horizontal axis labels document.getElementById("LabelPermissionsDiv").style.visibility = "visible"; } else { document.getElementById("LabelPermissionsDiv").style.visibility = "hidden"; } setLabelPreviewImage(); } function currentLabelChanged() { var option = document.getElementById("labelOptionsHiddenStore").childNodes[chartOptionsComboBoxes["labelSelect"].getSelectedItem()]; if (chartOptionValues[option.getAttribute("optionName")].details.type == CHART_OPTION_VALUE_TITLE) { option.setAttribute("title",document.getElementById("label_text").value); option.setAttribute("isdefault",(document.getElementById("label_isDefault").checked)? "true" : "false" ); } if (fontArray.length) option.setAttribute("font",chartOptionsComboBoxes["label_font"].getItem(chartOptionsComboBoxes["label_font"].getSelectedItem()).text); else option.setAttribute("font",""); var fontSizes = new Array(0,4,6,7,8,9,10,11,12,13,14,15,16,18,20); option.setAttribute("fontSize",fontSizes[chartOptionsComboBoxes["label_size"].getSelectedItem()]); option.setAttribute("color",getColorPickerColor("label_color")); if(fontArray.length) updateFontOptsButtons(); option.setAttribute("bold",document.getElementById("label_bold").getAttribute("pressed")); option.setAttribute("italic",document.getElementById("label_italic").getAttribute("pressed")); option.setAttribute("underline",document.getElementById("label_underlined").getAttribute("pressed")); updateLabelPreview(); } function selectCustomTitleOption() { if (!document.getElementById("label_notDefault").checked) { document.getElementById("label_notDefault").checked = true; document.getElementById("label_isDefault").checked = false; } } function updateLabelPreview() { var preview = document.getElementById("label_preview"); var option = document.getElementById("labelOptionsHiddenStore").childNodes[chartOptionsComboBoxes["labelSelect"].getSelectedItem()]; preview.style.fontFamily = option.getAttribute("font"); preview.style.color = "#" + option.getAttribute("color"); (option.getAttribute("bold") == "true")? preview.style.fontWeight = "bold" : preview.style.fontWeight = "normal" ; (option.getAttribute("italic") == "true")? preview.style.fontStyle = "italic" : preview.style.fontStyle = "normal" ; (option.getAttribute("underline") == "true")? preview.style.textDecoration = "underline" : preview.style.textDecoration = "none" ; } function updateFontOptsButtons() { var fontNo = chartOptionsComboBoxes["label_font"].getSelectedItem(); var bold_button = document.getElementById("label_bold"); var italic_button = document.getElementById("label_italic"); //First check the case that the font is set to both Bold and Italics if (bold_button.getAttribute("pressed") == "true" && italic_button.getAttribute("pressed") == "true") { if (!fontArray[fontNo].bolditalic) { //This font can't be both bold and italics, so if it can be bold simply unpress the italics //Button and fall through the bold button check. if (fontArray[fontNo].bold) { setItalicButtonEnabling(false); setButtonState(italic_button,false); } else { //Otherwise try disabling the Bold button, if the italics button //also needs disabling, it will be handled by the italics only if statement below. setBoldButtonEnabling(false); setButtonState(bold_button,false); } } } if (bold_button.getAttribute("pressed") == "true" && italic_button.getAttribute("pressed") != "true") { //Bold button is pressed, but the italics one isn't if (!fontArray[fontNo].bold) { //We can't be bold so unpress the button. setBoldButtonEnabling(false); setButtonState(bold_button,false); } else { //Set the italics buttons enabling appropriately. setItalicButtonEnabling(fontArray[fontNo].bolditalic); } } if (bold_button.getAttribute("pressed") != "true" && italic_button.getAttribute("pressed") == "true") { //Italics button is pressed, but the bold one isn't if (!fontArray[fontNo].italic) { //We can't be italisized so unpress the button. setItalicButtonEnabling(false); setButtonState(italic_button,false); } else { //Set the bold buttons enabling appropriately. setBoldButtonEnabling(fontArray[fontNo].bolditalic); } } if (bold_button.getAttribute("pressed") != "true" && italic_button.getAttribute("pressed") != "true") { //Neither button is pushed, so just set their enabling approriately. setBoldButtonEnabling(fontArray[fontNo].bold); setItalicButtonEnabling(fontArray[fontNo].italic); } } function setBoldButtonEnabling(enabled) { var button = document.getElementById("label_bold"); if (enabled) { button.setAttribute("isdisabled","false"); button.src = genericIconPath + "button_bold.gif"; } else { button.setAttribute("isdisabled","true"); button.src = genericIconPath + "button_bold_no.gif"; } } function setItalicButtonEnabling(enabled) { var button = document.getElementById("label_italic"); if (enabled) { button.setAttribute("isdisabled","false"); button.src = genericIconPath + "button_italics.gif"; } else { button.setAttribute("isdisabled","true"); button.src = genericIconPath + "button_italics_no.gif"; } } function chartDepthChanged() { var depthCheck = chartOptionValues["COGCB_UD"]; var barStyle = chartOptionValues["COGCB_S"]; var showMarkers = chartOptionValues["COGCL_SM"]; if (depthCheck && barStyle) { barStyle.control.disabled = depthCheck.control.checked; } if (depthCheck && showMarkers) { showMarkers.control.disabled = depthCheck.control.checked; } } function getNonLocalizedDecimalVal(val) { return val.replace(decimalpt,'.'); } function validatePercentageOfScreenValue(elem) { var validChars = "/[^0-9" + decimalpt + "\-]/"; if (elem) { var elemValue = parseFloat(getNonLocalizedDecimalVal(elem.value)); if (isNaN(elemValue)) return false; if ((!CNumUtil.validateNumField(elem, true, validChars)) || (elemValue < PERCENTAGE_SCREEN_MIN_VALUE) || (elemValue > PERCENTAGE_SCREEN_MAX_VALUE)) return false elem.value = elemValue; } return true; } function validateManualScaleValue(elem) { var validChars = "/[^0-9" + decimalpt + "\-]/"; if (elem) { var elemValue = parseFloat(getNonLocalizedDecimalVal(elem.value)); if (isNaN(elemValue)) return false; if (!CNumUtil.validateNumField(elem, true, validChars)) return false elem.value = elemValue; } return true; } function validateNumTicksValue(elem) { var validChars = "/[^0-9\-]/"; if (elem) { var elemValue = parseInt(getNonLocalizedDecimalVal(elem.value)); if (isNaN(elemValue)) return false; if (!CNumUtil.validateNumField(elem, true, validChars)) return false elem.value = elemValue; } return true; } function validateScaleFactorValue(elem) { var validChars = "/[^0-9\-]/"; if (elem) { var elemValue = parseInt(getNonLocalizedDecimalVal(elem.value)); if (isNaN(elemValue) || (elemValue == 0)) return false; if (!CNumUtil.validateNumField(elem, true, validChars)) return false elem.value = elemValue; } return true; } function validateFields(closePane) { if (chartOptionValues["COGC_FTP"]) { if (chartOptionValues["COGC_FTP"].control.checked) { var isValid = true; if (chartOptionValues["COGC_FTPW"] && chartOptionValues["COGC_FTPW"].control) { isValid = validatePercentageOfScreenValue(chartOptionValues["COGC_FTPW"].control); } if (isValid && chartOptionValues["COGC_FTPH"] && chartOptionValues["COGC_FTPH"].control) { isValid = validatePercentageOfScreenValue(chartOptionValues["COGC_FTPH"].control); } if (!isValid) { displayCommonMessage(strErrorMessageBadValue, MESSAGE_TYPE_INFO, [strColorPickerOK], [function() {removeMessage();}]); return false; } } else { chartOptionValues["COGC_FTPW"].control.value = chartOptionValues["COGC_FTPW"].details.value; chartOptionValues["COGC_FTPH"].control.value = chartOptionValues["COGC_FTPH"].details.value; } } if (chartOptionValues["COA_MS"]) { if (chartOptionValues["COA_MS"].control.checked) { var isValid = true; if (chartOptionValues["COA_MSI"] && chartOptionValues["COA_MSI"].control) { isValid = validateManualScaleValue(chartOptionValues["COA_MSI"].control); } if (isValid && chartOptionValues["COA_MSA"] && chartOptionValues["COA_MSA"].control) { isValid = validateManualScaleValue(chartOptionValues["COA_MSA"].control); } if (isValid && (parseFloat(chartOptionValues["COA_MSI"].control.value) > parseFloat(chartOptionValues["COA_MSA"].control.value))) isValid = false; if (!isValid) { displayCommonMessage(strErrorMessageBadScaleValue, MESSAGE_TYPE_INFO, [strColorPickerOK], [function() {removeMessage();}]); return false; } } else { chartOptionValues["COA_MSI"].control.value = chartOptionValues["COA_MSI"].details.value; chartOptionValues["COA_MSA"].control.value = chartOptionValues["COA_MSA"].details.value; } } if (chartOptionValues["COA_MS2"]) { if (chartOptionValues["COA_MS2"].control.checked) { var isValid = true; if (chartOptionValues["COA_MSI2"] && chartOptionValues["COA_MSI2"].control) { isValid = validateManualScaleValue(chartOptionValues["COA_MSI2"].control); } if (isValid && chartOptionValues["COA_MSA2"] && chartOptionValues["COA_MSA2"].control) { isValid = validateManualScaleValue(chartOptionValues["COA_MSA2"].control); } if (isValid && (parseFloat(chartOptionValues["COA_MSI2"].control.value) > parseFloat(chartOptionValues["COA_MSA2"].control.value))) isValid = false; if (!isValid) { displayCommonMessage(strErrorMessageBadScaleValue, MESSAGE_TYPE_INFO, [strColorPickerOK], [function() {removeMessage();}]); return false; } } else { chartOptionValues["COA_MSI2"].control.value = chartOptionValues["COA_MSI2"].details.value; chartOptionValues["COA_MSA2"].control.value = chartOptionValues["COA_MSA2"].details.value; } } if (chartOptionValues["COA_AT"]) { if (chartOptionValues["COA_AT"].control.checked) { var isValid = true; if (chartOptionValues["COA_NT"] && chartOptionValues["COA_NT"].control) { isValid = validateNumTicksValue(chartOptionValues["COA_NT"].control); } if (!isValid) { displayCommonMessage(strErrorMessageBadNumTicks, MESSAGE_TYPE_INFO, [strColorPickerOK], [function() {removeMessage();}]); return false; } } else { chartOptionValues["COA_NT"].control.value = chartOptionValues["COA_NT"].details.value; } } if (chartOptionValues["COA_AT2"]) { if (chartOptionValues["COA_AT2"].control.checked) { var isValid = true; if (chartOptionValues["COA_NT2"] && chartOptionValues["COA_NT2"].control) { isValid = validateNumTicksValue(chartOptionValues["COA_NT2"].control); } if (!isValid) { displayCommonMessage(strErrorMessageBadNumTicks, MESSAGE_TYPE_INFO, [strColorPickerOK], [function() {removeMessage();}]); return false; } } else { chartOptionValues["COA_NT2"].control.value = chartOptionValues["COA_NT2"].details.value; } } if (chartOptionValues["COL_LL"] && isOptionChanged("COL_LL")) { if (document.getElementById("COGC_HL") && document.getElementById("COGC_HL").checked) { if (closePane) displayCommonMessage(strErrorNotEmbeddedLegend, MESSAGE_TYPE_INFO, [strColorPickerOK,strColorPickerCancel], [function () {applyOptions(true,true);},function() {removeMessage();}]); else displayCommonMessage(strErrorNotEmbeddedLegend, MESSAGE_TYPE_INFO, [strColorPickerOK,strColorPickerCancel], [function () {applyOptions(false,true);},function() {removeMessage();}]); return false; } } if (chartOptionValues["COA_MSF"] && chartOptionValues["COA_SF"]) { if (chartOptionValues["COA_MSF"].control.checked) { if (!validateScaleFactorValue(chartOptionValues["COA_SF"].control)) { displayCommonMessage(strErrorBadScalingFactor, MESSAGE_TYPE_INFO, [strColorPickerOK], [function () {removeMessage();}]); return false; } } else { chartOptionValues["COA_SF"].control.value = chartOptionValues["COA_SF"].details.value; } } if (chartOptionValues["COA_MSF2"] && chartOptionValues["COA_SF2"]) { if (chartOptionValues["COA_MSF2"].control.checked) { if (!validateScaleFactorValue(chartOptionValues["COA_SF2"].control)) { displayCommonMessage(strErrorBadScalingFactor, MESSAGE_TYPE_INFO, [strColorPickerOK], [function () {removeMessage();}]); return false; } } else { chartOptionValues["COA_SF2"].control.value = chartOptionValues["COA_SF2"].details.value; } } return true; } function resetWidthByBorderAmount(obj,intendedSize) { if (obj) { if (parseInt(obj.offsetWidth) > intendedSize) { obj.style.width = intendedSize - (parseInt(obj.offsetWidth) - intendedSize); } } } //this function ensures that the user cannot select the same location for both the //Value and Pie label on the pie chart. function pieLabelOptionsChanged(event) { var eventM = null; if (event) eventM = new eventManager(event); var check_a = chartOptionValues["COP_VP"].control; var rad1_a = check_a.parentNode.parentNode.nextSibling.firstChild.nextSibling.firstChild.nextSibling; var rad2_a = rad1_a.parentNode.parentNode.nextSibling.firstChild.nextSibling.firstChild.nextSibling; var check_b = chartOptionValues["COP_LP"].control; var rad1_b = check_b.parentNode.parentNode.nextSibling.firstChild.nextSibling.firstChild.nextSibling; var rad2_b = rad1_b.parentNode.parentNode.nextSibling.firstChild.nextSibling.firstChild.nextSibling; rad1_b.disabled = false; rad2_b.disabled = false; rad1_a.disabled = false; rad2_a.disabled = false; if (check_a.checked && check_b.checked) { if (eventM && eventM.getSrc().getAttribute("optionName") == "COP_LP") { if (rad1_b.checked) { rad1_a.disabled = true; rad2_b.disabled = true; rad1_a.checked = false; rad2_a.checked = true; } else { rad2_a.disabled = true; rad1_b.disabled = true; rad2_a.checked = false; rad1_a.checked = true; } } else { if (rad1_a.checked) { rad1_b.disabled = true; rad2_a.disabled = true; rad1_b.checked = false; rad2_b.checked = true; } else { rad2_b.disabled = true; rad1_a.disabled = true; rad2_b.checked = false; rad1_b.checked = true; } } } }