Skip to content

Functions

Edward C. Deaver, IV edited this page Aug 5, 2019 · 13 revisions

FUNCTIONS:

generateKeyResult

  • Description:

    • Generates the key result data.
  • Type:

    • ASYNC
  • Return type:

    • VOID
  • The structure:

    • generateKeyResult(key, TargetName, mode, keyMode, combinationData, keyResultBanner, combinedPercentData)
  • The variables:

    • key
      • Type: String
      • Description: This is used to tell the dunction what obj and key result to use
      • Example: 'obj1kr1'
    • TargetName
      • Type: String
      • Description: HTML Name attribute of the container div for the key result.
    • Mode
    • keyMode
    • combinationData
      • Type: Data Object of CSV
      • Description: This the CSV dataset that fill the graphs on the page.
    • keyResultBanner
      • Type: Data Object of CSV
      • Description: This the CSV dataset that fills the key result banners.
    • combinedPercentData
      • Type: Data Object of CSV
      • Description: This is the CSV dataset that fills the left side and middle data.
      • Description: This the CSV dataset that fill the graphs on the page
    • money
      • Type: int
      • Description: Determines when money should be formatted like money.
      • Value: 1
        • Is the switch for the money formatting.
      • Value: 0
        • Doesn't switch.
    • indicatorRange
      • Type: Array
      • Description: Determines range for the dots coloring function in setindicators
      • Structure: [MID, HIGH]

constructDataForMaps

  • Description:
    • It groups the data from the map into individuals categories, gets the canvas elements for the objective and creates the charts for the data.
  • Type:
    • ASYNC
  • The structure:
    • constructDataForMaps(KeyResultDataSet, DataContainer)
  • The variables:
    • KeyResultDataSet
      • Type: Map object
      • Description: Map of grouped data via D3 Array grouping
    • DataContainer
      • Type: Object: 'document.getElementsByName(TargetName)[0]'

constructDataForMaps

  • Description:
    • It groups the data from the map into individuals categories, gets the canvas elements for the objective and creates the charts for the data.
  • The structure:
    • constructDataForMaps(KeyResultDataSet, DataContainer)
  • Return type:
    • VOID
  • The variables:
    • KeyResultDataSet
      • Type: Map object
      • Description: Map of grouped data via D3 Array grouping
    • DataContainer
      • Type: Object: 'document.getElementsByName(TargetName)[0]'

getCategoryDeptValues

  • Description:
    • Creates arrays of data for the left side and middle data.
  • The structure:
    • getCategoryDeptValues(data, mode)
  • Return type:
    • 2D Array
  • The variables:
    • data
      • Type: Map object
      • Description: Map of grouped data via D3 Array grouping
    • mode
      • Type: int
      • Description: defines what data sets to look for and return.
      • Value: 1/2
        • Description: Returns [arrayOfValues, arrayOfDenominator, arrayOfNumerator, nameOfCategory]
      • Value: 3
        • Description: Returns [project_dollars, authorized_dollars, spent_dollars, unspent_dollars, value, nameOfCategory]
      • Value: 4
        • Description: Returns [cardDescription, on_time, out_of_total, dataDescription, timeDescription,movement,color]

getData

  • Description:
    • Uses Fetch (no-cache) to get new file data
  • Type:
    • ASYNC
  • Return type:
    • Text Object
  • Structure:
    • getData(url)
  • Variables:
    • url
      • Type: string
      • Description: A http/s url of the file
      • Returns text of data

ChartJSGenrate

  • Description:
    • Generates chart js charts.
  • Structure:
    • ChartJSGenrate(xAxisLabel, xAxis, type, chartCanvasID, XscaleLabelName, YscaleLabelName, LegendLabel, displayLegend, displayXScale, displayYScale, displayXTicks, displayYTicks, displayBorderGridLinesXAxis, displayBorderGridLinesYAxis, displayGridLinesXAxis, displayGridLinesYAxis, numberOfValues)
  • Return type:
    • VOID
  • Variables:
    • xAxis
      • Type: Array
      • Description: labels in array for the x axis
    • type
      • Type: String
      • Description: String defines type of chart, see chartjs documentation for types
    • chartCanvasID
      • Type: String
      • Description: String that corresponds with the Canvas ID you want the chart in
    • XscaleLabelName
      • Type: String
      • Description: String for the X label
    • YscaleLabelName
      • Type: String
      • Description: String for Y label
    • LegendLabel
      • Type: String
      • Description: Label for the legend.
    • displayLegend
      • Type: Boolean
      • Description: True or False to display legend.
    • displayXScale
      • Type: Boolean
      • Description: True or False to display X Scale.
    • displayYScale
      • Type: Boolean
      • Description: True or False to display Y Scale.
    • displayXTicks
      • Type: Boolean
      • Description: True or False to display X ticks.
    • displayYTicks
      • Type: Boolean
      • Description: True or False to display Y ticks.
    • displayBorderGridLinesXAxis
      • Type: Boolean
      • Description: True or False to display X axis gridlines.
    • displayBorderGridLinesYAxis
      • Type: Boolean
      • Description: True or False to display y axis gridlines.
    • displayGridLinesXAxis / displayGridLinesYAxis
      • Type: Boolean
      • Description: True or False to display lines for y/x axis.
    • numberOfValues
      • Type: int
      • Description: number of values

splitData

  • Description:
    • Splits the data between a dataset value and the time period
  • Structure:
    • splitData(dataSet, keyValue)
  • Return type:
    • 2D Array
  • Variables:
    • dataSet
      • Type: 2D array
      • Description: Holds the data
    • keyValue
      • Unused

setIndicators

  • Description:
    • Changes indicator numbers and objects based on input.
  • Type:
    • ASYNC
  • Structure:
    • setIndicators(percentageCalculation, domElement, typeToSet, mode)
  • Return type:
    • VOID
  • Variables:
    • percentageCalculation
      • Type: Array
      • Description: The data you want fed into the indicators.
    • domElement
      • Type: Object: 'document.getElementsByName(TargetName)[0]'
    • typeToSet
      • Type: String
      • Description: The type of data to control: money, color, number, date
      • Values:
        • money
          • Description: Sets the inner html of the dom element at index to a US Dollar formatted amount.
        • color
          • Description: Sets the color of the dots, the arrows on the front page and the progress message color and text on the front page.
            • mode == 1 is the dots color
            • mode == 2 is the progress message color and text
            • mode== 3 is the arrow direction on the front page.
        • number
          • Description: Just sets whatever is in percentageCalculation at index to domElement at index innerhtml.
        • date
          • Description: Just sets whatever is in percentageCalculation at index to domElement at index innerhtml.

generateKeyBoxResult

  • Description:
    • Creates the boxes on the front page. Acts very similar to generateKeyResult.
  • Type:
    • ASYNC
  • Structure:
    • generateKeyBoxResult(key, TargetName, data)
  • Return type:
    • VOID
  • Variables:
    • key
      • Type: String
      • Description: This is the key value for the objective in the MainPageCSV csv: example: "obj1"
    • TargetName
      • Type: String
      • Description: This is the div name for each objective: example: "objective1"
    • data
      • Type: Data object
      • Description: This the CSV dataset that fills the indicators on the page

setDateData

  • Description:
    • Sets the date based on last commit date on github of given file url
  • Structure:
    • setDateData(url,TargetName)
  • Return type:
    • VOID
  • Variables
    • url
      • Type: String
      • Description: Should be github rest API url
    • TargetName
      • Type: String
      • Description: Class name where date span object sits inside.

formatMoney

  • Description:
    • Formats money to the USA dollar format.
  • Structure:
    • formatMoney(number)
  • Return type:
    • Number Currency
  • Variables:
    • number
      • Type: Int
      • Description: Number that will be returned as string object.
Clone this wiki locally