Class GraphFormatHelper


  • public class GraphFormatHelper
    extends java.lang.Object
    This class provides a series of methods that aid on the manipulation of graph formatting properties.
    Since:
    MicroStrategy Web 7.3.1 or earlier
    • Field Detail

      • SHOW_MINIMUM_INDEX

        public static final int SHOW_MINIMUM_INDEX
        Index value pointing to the place where it indicates if the minimum property should be shown or not.
        Since:
        MicroStrategy Web 8.0.0
        See Also:
        Constant Field Values
      • SHOW_MAXIMUM_INDEX

        public static final int SHOW_MAXIMUM_INDEX
        Index value pointing to the place where it indicates if the maximum property should be shown or not.
        Since:
        MicroStrategy Web 8.0.0
        See Also:
        Constant Field Values
      • VALUE_MINIMUM_INDEX

        public static final int VALUE_MINIMUM_INDEX
        Index value pointing to the place where the minimum value is located.
        Since:
        MicroStrategy Web 8.0.0
        See Also:
        Constant Field Values
      • VALUE_MAXIMUM_INDEX

        public static final int VALUE_MAXIMUM_INDEX
        Index value pointing to the place where the maximum value is located.
        Since:
        MicroStrategy Web 8.0.0
        See Also:
        Constant Field Values
      • LocalShowGraphAttributeID

        public static final int LocalShowGraphAttributeID
        Enum for undefined graph property
        Since:
        MicroStrategy Web 9.0.0
        See Also:
        Constant Field Values
    • Constructor Detail

      • GraphFormatHelper

        public GraphFormatHelper()
    • Method Detail

      • generateMajorGraphTypesImages

        public static Tag[] generateMajorGraphTypesImages​(WebComponent bean,
                                                          AppContext appContext,
                                                          ShortcutList majorTypePicker,
                                                          java.lang.String paramNamePrefix,
                                                          java.lang.String currentValue,
                                                          java.lang.String selectedCss)
        Generate a series of Tag objects corresponding to images for the graph major type picker requested.
        Parameters:
        bean - WebComponent base bean from where Messages and features can be asked
        appContext - AppContext instance from where Messages can be retrieved
        majorTypePicker - ShortcutList instance with the information of the major types to render
        paramNamePrefix - String value with the prefix name for the resulting image tags.
        currentValue - String value with the current major type selected
        selectedCss - String value with the css class to assign to the currently selected graph major type image.
        Returns:
        Tag[] an array of Tag instances including each one of the images of the major types to render to the user
        Since:
        MicroStrategy Web 8.0.0
      • generateMinorGraphTypesCombo

        public static Tag generateMinorGraphTypesCombo​(WebComponent bean,
                                                       AppContext appContext,
                                                       ShortcutList minorTypePicker,
                                                       java.lang.String paramName,
                                                       java.lang.String currentValue)
        Generate a Tag instance with all the information required for displaying the user the different options for graph minor type.
        Parameters:
        bean - WebComponent base bean from where Messages and features can be asked
        appContext - AppContext instance from where Messages can be retrieved
        minorTypePicker - ShortcutList instance with the information of the minor types to render
        paramName - String value with the name the resulting select box tag will have
        currentValue - String value with the current minor type selected
        Returns:
        Tag instance initialized with all the information and options to present to the user as graph minor types available.
        Since:
        MicroStrategy Web 8.0.0
      • isGraph3D

        public static boolean isGraph3D​(int majorType)
        This method determines if the graph major type sent as parameter corresponds to a 3D graph type
        Parameters:
        majorType - an element of the EnumDSSXMLMajorGraphTypes enumeration
        Returns:
        a True if the graph representation is 3D. Otherwise returns False.
      • getGraphAttributeID

        public static int getGraphAttributeID​(int objectID)
        Utility method taht based on the objectID sent as parameter, get the corresponding attribute ID for its show flag
        Parameters:
        objectID - the object being analyzed
        Returns:
        an element of the EnumDSSXMLGraphAttributeID enumeration corresponding to the show flag for the object requested
        Since:
        MicroStrategy Web 8.0.0
      • getGraphAttributeID

        public static int getGraphAttributeID​(int objectID,
                                              int seriesID)
        Utility method that based on the objectID sent as parameter, get the corresponding attribute ID for its show flag
        Parameters:
        objectID - the object being analyzed
        seriesID - the series being analyzed
        Returns:
        an element of the EnumDSSXMLGraphAttributeID enumeration corresponding to the show flag for the object requested
        Since:
        MicroStrategy Web 8.1.1
      • getGraphNumFormatObjectID

        public static int getGraphNumFormatObjectID​(int objectID)
        Utility method that adjust the objectID for Graph number format attribute
        Parameters:
        objectID - the object being analyzed
        Returns:
        an element of the EnumDSSXMLGraphObjectID enumeration used in Graph number format
        Since:
        MicroStrategy Web 9.0.0
      • getGraphNumFormatAttributeID

        public static int getGraphNumFormatAttributeID​(int objectID)
        Utility method that based on the objectID sent as parameter, get the corresponding attribute ID used for Graph number format attribute
        Parameters:
        objectID - the object being analyzed
        Returns:
        an element of the EnumDSSXMLGraphAttributeID enumeration corresponding to Graph number format attribute
        Since:
        MicroStrategy Web 9.0.0
      • getApplicableAxisTitles

        @Deprecated
        public static GraphTitleInformation[] getApplicableAxisTitles​(int majorType,
                                                                      int minorType)
        Deprecated.
        Given the graph major and minor type, it gets the list of titles that should be enabled to be modified and included as arguments for the formatting event to handle axis titles.
        Parameters:
        majorType - an element of the EnumDSSXMLMajorGraphTypes enumeration
        minorType - the minor type selected
        Returns:
        an array of GraphTitleInformation instances that contain the information of the axis titles applicable given the graph major and minor type.
        Since:
        MicroStrategy Web 8.0.0
      • isLegendSupported

        public static boolean isLegendSupported​(int majorType)
        Determines given the major graph type if Legends are supported or not
        Parameters:
        majorType - an element of the EnumDSSXMLMajorGraphTypes enumeration
        Returns:
        True if this graph type supports Legends. Otherwise, returns False
      • getApplicableAxisValues

        public static GraphAxisInformation[] getApplicableAxisValues​(int majorType)
        Given the graph major type, it gets the list of axis that should be enabled to be modified and included as arguments for the formatting event to handle axis values.
        Parameters:
        majorType - an element of the EnumDSSXMLMajorGraphTypes enumeration
        Returns:
        an array of GraphAxisInformation instances containing the information of the axis titles applicable given the graph major type. For the ObjectID related with this axis, for these properties EnumDSSXMLGraphObjectID.DssXmlObjectIDNull should be used, that's why this method doesn't include this value.
      • retrieveIntervalValues

        public static java.lang.String retrieveIntervalValues​(java.lang.String interval)
        Processes the interval property value obtained from the metadata
        Parameters:
        interval - String value of the graph property
        Returns:
        null if the interval option was not selected. Otherwise, returns the value saved in the metadata (meaning the option is checked)
        Since:
        MicroStrategy Web 8.0.0
      • retrieveMinMaxFromScale

        public static java.lang.String[] retrieveMinMaxFromScale​(java.lang.String scale)
        Based on the Scale string, retrieve the values of the properties to use
        Parameters:
        scale - a String with the information of the graph's scale property saved on the metadata
        Returns:
        an array with four values. The indexes to use for accessing this information are SHOW_MAXIMUM_INDEX, SHOW_MINIMUM_INDEX, VALUE_MINIMUM_INDEX and VALUE_MAXIMUM_INDEX
        Since:
        MicroStrategy Web 8.0.0
      • getGraphProperty

        public static java.lang.String getGraphProperty​(WebGraphProperties graphProperties,
                                                        int objectID,
                                                        int attributeID)
        Retrieves the requested property from the graph
        Parameters:
        graphProperties - a WebGraphProperties initialized instance
        objectID - a valid objectID for the property
        attributeID - a valid attributeID for the property
        Returns:
        the value of the property requested, or a null if the property was not found.
      • getGraphSeries

        public static java.util.ArrayList getGraphSeries​(int maxSeries,
                                                         WebGraphProperties graphProperties)
        Based on the graph properties provided, returns an ArrayList instance with WebGraphProperty elements of all the series available.
        Parameters:
        graphProperties - WebGraphProperties initialized instance
        Returns:
        ArrayList initialized instance, with WebGraphProperty elements corresponding to each one of the visible series available on the graph.
        Since:
        MicroStrategy Web 9.0.0
      • getGraphProperty

        public static java.lang.String getGraphProperty​(WebGraphProperties graphProperties,
                                                        int objectID,
                                                        int attributeID,
                                                        int seriesID)
        Retrieves the requested property from the graph
        Parameters:
        graphProperties - a WebGraphProperties initialized instance
        objectID - a valid objectID for the property
        attributeID - a valid attributeID for the property
        seriesID - a valid seriesID for the property
        Returns:
        the value of the property requested, or a null if the property was not found.
        Since:
        MicroStrategy Web 8.0.1
      • obtainMajorTypesFilter

        public static java.lang.String obtainMajorTypesFilter​(int[] includeValues)
        Utility method to generate a filter that will be used for determining which objects will be shown or not to the user, based on the graph major type currently selected.
        Parameters:
        includeValues - array of integer values to be included on the string
        Returns:
        a String value with the different major type values separated by commas. Those values included on the includeValues parameter will be added to the resulting filter string.
        Since:
        MicroStrategy Web 8.0.0
      • generateMacroInformationTag

        public static ImageTag generateMacroInformationTag​(WebComponent wc)
        Generates an information image tag with tooltip details about how macros can be used on text fields for content properties on a graph.
        Parameters:
        wc - WebComponent initialized instance
        Returns:
        ImageTag instance initialized as an image with the macro information to display to the user as its tooltip.
        Since:
        MicroStrategy Web 8.0.1
      • obtainMajorTypesFilter

        public static java.lang.String obtainMajorTypesFilter​(java.util.Hashtable exceptValues)
        Utility method to generate a filter that will be used for determining which objects will be shown or not to the user, based on the graph major type currently selected.
        Parameters:
        exceptValues - hash table with the values not to include on the resulting filter
        Returns:
        a String value with the different major type values separated by commas. Those values included on the exceptValues parameter will not be included on the resulting filter string.
        Since:
        MicroStrategy Web 8.0.0
      • getGraphFormatTargets

        public static GraphTitleInformation[] getGraphFormatTargets()
        Since:
        MicroStrategy Web 8.0.1
      • getGraphLabelTargets

        public static GraphTitleInformation[] getGraphLabelTargets()
        Since:
        MicroStrategy Web 8.0.1
      • getGraphTitleTargets

        public static GraphTitleInformation[] getGraphTitleTargets()
        Since:
        MicroStrategy Web 8.0.1
      • getGraphAxisTargets

        public static GraphTitleInformation[] getGraphAxisTargets()
        Since:
        MicroStrategy Web 8.0.1
      • isTargetForAll

        public static boolean isTargetForAll​(int graphTargetID)
        This method determines whether the graph target is a place holder for All items (e.g. All Texts, All Titles) For those place holders, their fontStyle values should be depending on the contained individual items instead of the values from their own
        Parameters:
        graphTargetID - an element of the EnumDSSXMLGraphObjectID enumeration
        Returns:
        a True if the graph target is a place holder indicating a All "X" item. Otherwise returns False.
        Since:
        MicroStrategy Web 9.0.0
      • getGraphSeriesColorTargets

        public static GraphSeriesInformation[] getGraphSeriesColorTargets​(int major,
                                                                          int minor)
        Since:
        MicroStrategy Web 8.0.1
      • getGraphSeriesColorTargets

        public static java.util.ArrayList getGraphSeriesColorTargets​(AppContext appContext,
                                                                     WebGraphProperties graphProperties)
        Get the information about the applicable series color targets, depending on the major and minor types currently associated with the graph
        Parameters:
        appContext - AppContext instance
        graphProperties - WebGraphProperties instance related to the graph to analyze
        Returns:
        ArrayList instance of GraphSeriesInformation instances with the applicable series color targets
        Since:
        MicroStrategy Web 8.0.1
      • getGraphSeriesColorTargets

        public static java.util.ArrayList getGraphSeriesColorTargets​(AppContext appContext,
                                                                     WebGraphProperties graphProperties,
                                                                     GraphSeriesTargetInfo gstInfo)
        Get the information about the applicable series label targets, depending on the major and minor types currently associated with the graph
        Parameters:
        appContext - AppContext instance
        graphProperties - WebGraphProperties instance related to the graph to analyze
        Returns:
        ArrayList instance of GraphSeriesInformation instances with the applicable series label targets
        Since:
        MicroStrategy Web 9.0.0
      • getGraphSeriesLabelTargets

        public static GraphSeriesInformation[] getGraphSeriesLabelTargets​(int major,
                                                                          int minor)
        Get the information about the applicable series label targets, depending on the major and minor types currently associated with the graph
        Parameters:
        major - int value with the graph major type
        minor - int value with the graph minor type
        Returns:
        GraphSeriesInformation[] array with the applicable series labels targets
        Since:
        MicroStrategy Web 8.0.1
      • renderMajorGraphTypes

        @Deprecated
        public static void renderMajorGraphTypes​(MarkupOutput out,
                                                 int availableGraphTypes,
                                                 int currentGraphType,
                                                 java.lang.String imgSourcePath,
                                                 java.lang.String majorTypeParam,
                                                 AppContext appContext)
        Deprecated.
        Displays the images that correspond to the graph types available given the flag of available graph types
        Parameters:
        out - instance of MarkupOutput that will hold the HTML output of this method
        availableGraphTypes - flag from the Report Data that indicates which major graph types are available to a given report.
        currentGraphType - major type used currently for a given report.
        imgSourcePath - source path where images to be displayed are located.
        majorTypeParam - prefix name to use for the controls to be displayed.
        appContext - a AppContext instance.
      • renderMinorGraphTypes

        @Deprecated
        public static void renderMinorGraphTypes​(MarkupOutput out,
                                                 int currentGraphType,
                                                 int currentMinorType,
                                                 java.lang.String minorTypeParam,
                                                 AppContext appContext,
                                                 java.lang.String extraParameters)
        Deprecated.
        Displays the combo box that corresponds to the minor graph types available given the current graph major types
        Parameters:
        out - instance of MarkupOutput that will hold the HTML output of this method
        currentGraphType - major type used currently for a given graph.
        currentMinorType - minor type used currently for a given graph.
        minorTypeParam - name to use for the control to be displayed.
        appContext - a AppContext instance.
        extraParameters - any other attributes that should be added to the Select control to be rendered.
      • getApplicableAxisTitles

        @Deprecated
        public static GraphTitleInformation[] getApplicableAxisTitles​(int majorType)
        Deprecated.
        Please use the interface that receives both major and minor types as arguments. The logic for validating which axis are applicable depend on these two properties.
        Given the graph major type, it gets the list of axis that should be enabled to be modified and included as arguments for the formatting event to handle axis titles.
        Parameters:
        majorType - an element of the EnumDSSXMLMajorGraphTypes enumeration
        Returns:
        an array of GraphTitleInformation instances that contain the information of the axis titles applicable given the graph major type.
      • getSupportPropertyId

        public static int getSupportPropertyId​(int attributeID)
        Returns the grouping category id for an attribute id
        Parameters:
        attributeID -
        Since:
        MicroStrategy Web 9.0.0
      • getGraphSeriesTargetInfo

        public static GraphSeriesTargetInfo getGraphSeriesTargetInfo​(WebGraph graphObj,
                                                                     boolean isRWBean)
        Since:
        MicroStrategy Web 9.0.0
      • getMaxGraphSeries

        public static int getMaxGraphSeries​(WebGraph graphObj)
        Since:
        MicroStrategy Web 9.0.0
      • getRiserObjectID

        public static int getRiserObjectID​(int orgRiserID)
        This method is to transform some special riser id to the common riser id If the original id is not a valid riser object id, just maintain it
        Parameters:
        orgRiserID -
        Since:
        MicroStrategy Web 9.0.0
      • isCombinableAttr

        public static boolean isCombinableAttr​(int attributeId)
        For some attribute, we can't directly get property value for "All" target. This method can help to check out these attributes
        Parameters:
        attributeId -
        Since:
        MicroStrategy Web 9.0.0
      • hasPrivilegesForTitle

        public static boolean hasPrivilegesForTitle​(WebComponent bean,
                                                    int objectId)
        This method can check if user has format privilege on giving title item.
        Parameters:
        bean -
        objectId -
        Since:
        MicroStrategy Web 9.0.0
      • getValueForAllTitleTarget

        public static java.lang.String getValueForAllTitleTarget​(WebGraphProperties graphProperties,
                                                                 GraphTitleInformation[] availableTitles,
                                                                 int objectId,
                                                                 int attributeId,
                                                                 WebComponent bean)
        This method is designed to compute the related property value for those "all" target, such as: All Text, All Titles, All Axes We check values of sub targets for each "all" target. If value are same, set it to "all" target; If not, set empty to "all" target
        Parameters:
        graphProperties -
        availableTitles -
        objectId -
        attributeId -
        bean -
        Since:
        MicroStrategy Web 9.0.0
      • getValueForAllSeriesLabelTarget

        public static java.lang.String getValueForAllSeriesLabelTarget​(WebGraphProperties graphProperties,
                                                                       java.util.ArrayList graphSeries,
                                                                       int orgAttributeId,
                                                                       WebComponent bean)
        This method is designed to compute the related property value for "All Data Label" target. We check values of sub targets for each series label. If values are same, set it to "all" target; If not, set empty to "all" target
        Parameters:
        graphProperties -
        graphSeries -
        orgAttributeId -
        bean -
        Since:
        MicroStrategy Web 9.0.0
      • getPropertyValue

        public static java.lang.String getPropertyValue​(WebGraphProperties graphProperties,
                                                        int objectId,
                                                        int attributeId,
                                                        int seriesId)
        Since:
        MicroStrategy Web 9.0.0
      • getPropertyValue

        public static java.lang.String getPropertyValue​(WebGraphProperties graphProperties,
                                                        int objectId,
                                                        int attributeId)
        Since:
        MicroStrategy Web 9.0.0