Knack Operations
  • TABLE OF CONTENTS
  • Knack Operations Read-Only
  • Knack
    • Platform Overview
    • Functionality Guide
    • Style Guide
    • Single Sign On (SSO)
      • Configuring a new Knack App with certificates
      • Enabling SSO in Knack
      • Configuring new certificates for all Knack Apps - When certs expire!
        • SSL Certificate Management
      • Configuring an existing Knack App with certificates (Rare)
    • Banner Logos
    • Rounding Knack Costs Correctly
    • URL Parameters to populate a form
    • Importing Records
    • Copy an Application
  • Knack Integrations
    • Open Data Portal - Socrata Integration
    • ArcGIS Online Integration
    • CSR configuration prep in Knack
      • Creating CSR Page components
  • Knack Code
    • Code Version Control
    • GitHub Code Workflow
    • CODE: Retrieve builder URL of Email Rules
    • CODE: Mobile Optimization
      • Detail Labels
    • CODE: Custom Login Buttons
    • CODE: Vision Zero in Action
    • CODE: Knack Functionality
      • Big Buttons
      • Save Knack Record ID
      • Redirect Blank Menu Pages
      • Disable Trigger Buttons
      • Disable Modal Background Click/Touch
      • Disable Breadcrumb Navigation Links
      • Remove Back Links
      • Back Link Buttons
      • Return to Previous Page Button
      • Auto Input Validation Form Fields
      • Conditionally Hide/Show Form Fields
      • Return to Top Button
      • Refresh View Button
      • Detect IE
      • Set Map iFrame Source URL
    • CODE: Knack Look & Feel
      • Multipage Step Indicator
      • Modal Close Styling
      • Relabel Attachment Links
      • Navigation Dropdown Menu Buttons
      • In-Form Dropdown Menu Buttons
      • Trigger Buttons
      • Hyperlink a Form Field Label
      • Remove Table Header
      • Modify Table Summary Rows
      • Convert Values to UPPERCASE (Option A)
      • Convert Values to UPPERCASE (Option B)
      • Highlight Details View Label Body & Table Value
      • Report Headers
      • Report Filters Container Size
      • Report Element Colors
      • HighCharts Report Styling
      • Font Awesome Icons
    • CODE: Knack Print Page
      • Print Header with Page Break/Number
      • Print without overlapping views
      • Print using Menu Button
      • Print using Trigger Button
      • Show Character Limit of Input
      • Add fixed Footer on Print
  • AMD | DATA TRACKER
    • AMD | Data Tracker
    • Asset Changes
    • CSR | Flex Note Archiving
    • Cameras
    • Fix Broken CCTV Device Status Page Links
    • Performance Measures
    • Builder Notes
      • Configure New AMD Asset in Data Tracker
      • Data Tracker | Annual Signal and PHB Request Ranking
      • Page Rules (TMC) CSR
      • NOTIFICATION | Construction Status Email
      • NOTIFICATION | One Day Signal Engineer Due Date
      • DETAILS | Preventative Maintenance (PM)
      • DETAILS | Signal Detectors Object Tables, Reports, misc..
      • DETAILS | Signals
      • Signals Work Order | EDIT FORMS
      • Signals Work Order | FORM LOCATIONS
      • Editing Signals Work Order | NEW FORMS
    • Warehouse Inventory - Updating Journal Vouchers (JV) information
    • Cancel Transactions & Replenishments
    • Adjustment Transaction, Unit Cost Adjustments & Re-Stock
    • DTS | Adminstrative Action
  • DTS | Data & Technology Services Portal
    • DTS | Data & Technology Services Portal
    • Dataset inventory
    • Application Inventory
  • Finance & Purchasing
    • Finance & Purchasing Portal
    • Finance & Purchasing
      • Training, Quiz, Account Access Process
      • Statuses
      • List of emails generated
      • Re/Un-assigning Approver of a PR (Purchase Request)
      • Troubleshooting: FAQs
    • Warehouse Inventory
      • Adding a new inventory item
  • HiRe | The Hiring Resource
    • HiRe | The Hiring Resource
  • HR | Human Resources
    • HR | Human Resources Portal
    • How to add a new HR Form
  • PEP | Parking Enterprise Portal
    • PEP | Parking Enterprise Portal
    • Dispatch Resource Tracking Log Archiving
    • Update Parking Citation Report by Fiscal Year (FY)
  • ROW | Right of Way Portal
    • ROW | Right of Way Portal
    • COS JV Update
  • RPP | Residential Parking Permit Portal
    • RPP | Residential Parking Permits
    • Residential Parking Permits
    • RPP Migration
  • SBO | Street & Bridge Operations
    • SBO | Street & Bridge Operations
  • SMD | Signs & Markings Operations
    • SMD | Signs & Markings Operations
    • Table of Contents
    • Workflow
    • Markings | Work Orders
      • Process & Module Functionality
    • Markings | Service Requests
      • Process & Module Functionality
    • Signs | Work Orders
      • Process & Module Functionality
    • Signs | Service Requests
      • Process & Functionality
    • Contractor | Work Orders
      • Process & Module Functionality
    • Sign Fabrication Work Orders
      • Process and Functionality
    • Special Functions/Codes
      • Work Order Attachments
  • SMO | Smart Mobility Operations
    • SMO | Smart Mobility Portal
  • SMS | Shared Mobility Services
    • SMS | Shared Mobility Portal
    • License & Permit Management
    • Sources for Monthly Trip Records
  • STREET BANNER PROGRAM
    • Street Banner Program
    • Street Banner Program
  • TDS | Transportation Development Services
    • TDS | Transportation Development Services Portal
    • Color Palette
    • Role Permissions Guide
    • App Logic
      • Calculating Date Values for Reporting
      • Incrementing Review Cycle Automatically
      • Calculating Review Time & On Time Percentage
      • Calculating Cycle Completion Percentage
      • Calculating an Expiration Date
      • Automatic Due Date with Manual Adjustment
      • Roll up Child Object Conditionals
      • Converting an Entered Percentage to a Percentage Value
      • Create a Connection Link Field to View a Searched Record
      • Extracting Location Coordinates to add a Map Marker Map
    • TDR | Development Reviews
    • TIA | Traffic Impact Analysis
    • TDA | Transportation Development Assessments
  • Traffic Register
    • Traffic Register
    • Table of Contents
    • Workflow
    • Modules
    • Special Functions/Code
    • Permissions
  • TPW Forms
    • TPW Forms
  • VZA | Vision Zero in Action
    • VZA | Vision Zero in Action
    • Batch Copy Process for VZA Assignments
    • Calculate School Closures
    • Login Process for Officers
    • Officer Records
    • Update reports in Power BI
    • Use Tasks for Creating Child Records
    • Use Tasks for Notifications
  • O365 Resources
    • Resources
Powered by GitBook
On this page
  • The JS
  • The CSS
  • How to Implement
  • More Info

Was this helpful?

  1. Knack Code
  2. CODE: Knack Look & Feel

Report Element Colors

How to apply matching colors between different chart types

PreviousReport Filters Container SizeNextHighCharts Report Styling

Last updated 11 months ago

Was this helpful?

  1. #7cb5ec

  2. #434348

  3. #90ed7d

  4. #f7a35c

  5. #8085e9

  6. #f15c80

  7. #e4d354

  8. #2b908f

  9. #f45b5b

  10. #91e8e1

The JS

The CSS

There are several different situations, based on the number of calculated elements in a chart, that determine what kind of selector we use to change the colors.

If you have 10 or more elements (values) being calculated, you can use a simplified notation the negates the need for more than 10 lines of code

#kn-report-view_1369-1 div.highcharts-container svg g.highcharts-series-group g.highcharts-series rect:nth-child(10n){fill: #91e8e1;}
#kn-report-view_1369-1 div.highcharts-container svg g.highcharts-series-group g.highcharts-series rect:nth-child(10n+1){fill: #7cb5ec;}
#kn-report-view_1369-1 div.highcharts-container svg g.highcharts-series-group g.highcharts-series rect:nth-child(10n+2){fill: #434348;}
#kn-report-view_1369-1 div.highcharts-container svg g.highcharts-series-group g.highcharts-series rect:nth-child(10n+3){fill: #90ed7d;}
#kn-report-view_1369-1 div.highcharts-container svg g.highcharts-series-group g.highcharts-series rect:nth-child(10n+4){fill: #f7a35c;}
#kn-report-view_1369-1 div.highcharts-container svg g.highcharts-series-group g.highcharts-series rect:nth-child(10n+5){fill: #8085e9;}
#kn-report-view_1369-1 div.highcharts-container svg g.highcharts-series-group g.highcharts-series rect:nth-child(10n+6){fill: #f15c80;}
#kn-report-view_1369-1 div.highcharts-container svg g.highcharts-series-group g.highcharts-series rect:nth-child(10n+7){fill: #e4d354;}
#kn-report-view_1369-1 div.highcharts-container svg g.highcharts-series-group g.highcharts-series rect:nth-child(10n+8){fill: #2b908f;}
#kn-report-view_1369-1 div.highcharts-container svg g.highcharts-series-group g.highcharts-series rect:nth-child(10n+9){fill: #f45b5b;}

We use incremental notation if we have 10 or fewer elements

#kn-report-view_1369-1 div.highcharts-container svg g.highcharts-series-group g.highcharts-series rect:nth-child(1){fill: #7cb5ec;}
#kn-report-view_1369-1 div.highcharts-container svg g.highcharts-series-group g.highcharts-series rect:nth-child(2){fill: #434348;}
#kn-report-view_1369-1 div.highcharts-container svg g.highcharts-series-group g.highcharts-series rect:nth-child(3){fill: #90ed7d;}
#kn-report-view_1369-1 div.highcharts-container svg g.highcharts-series-group g.highcharts-series rect:nth-child(4){fill: #f7a35c;}
#kn-report-view_1369-1 div.highcharts-container svg g.highcharts-series-group g.highcharts-series rect:nth-child(5){fill: #8085e9;}
#kn-report-view_1369-1 div.highcharts-container svg g.highcharts-series-group g.highcharts-series rect:nth-child(6){fill: #f15c80;}
#kn-report-view_1369-1 div.highcharts-container svg g.highcharts-series-group g.highcharts-series rect:nth-child(7){fill: #e4d354;}
#kn-report-view_1369-1 div.highcharts-container svg g.highcharts-series-group g.highcharts-series rect:nth-child(8){fill: #2b908f;}
#kn-report-view_1369-1 div.highcharts-container svg g.highcharts-series-group g.highcharts-series rect:nth-child(9){fill: #f45b5b;}
#kn-report-view_1369-1 div.highcharts-container svg g.highcharts-series-group g.highcharts-series rect:nth-child(10){fill: #91e8e1;}

Or if you would like to modify the colors to a pie chart, you need to change the color for both the pie slice and the rect legend element. In this example we specify unique colors that match the RPP zone colors.

#kn-report-view_1317-2 div.highcharts-container svg g.highcharts-series-group g.highcharts-series path:nth-child(1) {fill: DodgerBlue;}
#kn-report-view_1317-2 div.highcharts-container svg g.highcharts-legend g:nth-child(1).highcharts-legend-item rect{fill: DodgerBlue;}
#kn-report-view_1317-2 div.highcharts-container svg g.highcharts-series-group g.highcharts-series path:nth-child(2) {fill: #b29700;}
#kn-report-view_1317-2 div.highcharts-container svg g.highcharts-legend g:nth-child(2).highcharts-legend-item rect{fill: #b29700;}
#kn-report-view_1317-2 div.highcharts-container svg g.highcharts-series-group g.highcharts-series path:nth-child(3) {fill: Green;}
#kn-report-view_1317-2 div.highcharts-container svg g.highcharts-legend g:nth-child(3).highcharts-legend-item rect{fill: Green;}
#kn-report-view_1317-2 div.highcharts-container svg g.highcharts-series-group g.highcharts-series path:nth-child(4) {fill: Orange;}
#kn-report-view_1317-2 div.highcharts-container svg g.highcharts-legend g:nth-child(4).highcharts-legend-item rect{fill: Orange;}
#kn-report-view_1317-2 div.highcharts-container svg g.highcharts-series-group g.highcharts-series path:nth-child(5) {fill: LightPink;}
#kn-report-view_1317-2 div.highcharts-container svg g.highcharts-legend g:nth-child(5).highcharts-legend-item rect{fill: LightPink;}
#kn-report-view_1317-2 div.highcharts-container svg g.highcharts-series-group g.highcharts-series path:nth-child(6) {fill: Purple;}
#kn-report-view_1317-2 div.highcharts-container svg g.highcharts-legend g:nth-child(6).highcharts-legend-item rect{fill: Purple;}
#kn-report-view_1317-2 div.highcharts-container svg g.highcharts-series-group g.highcharts-series path:nth-child(7) {fill: Red;}
#kn-report-view_1317-2 div.highcharts-container svg g.highcharts-legend g:nth-child(7).highcharts-legend-item rect{fill: Red;}
#kn-report-view_1317-2 div.highcharts-container svg g.highcharts-series-group g.highcharts-series path:nth-child(8) {fill: Turquoise;}
#kn-report-view_1317-2 div.highcharts-container svg g.highcharts-legend g:nth-child(8).highcharts-legend-item rect{fill: Turquoise;}

How to Implement

You can simply copy the CSS above that is applicable depending on how many elements you have, what chart you are manipulating, and what colors are being used.

The report View ID will need to be updated for each line. Additionally, the number after the View ID indicates which report in the report view you are manipulating. For example if you had 2 reports in a view, the first would be 1, the second would be 2. With the New Knack Builder, it is not recommended to have more than 2 reports per report view so that report views can easily be managed and copied.

/*Report 1 in the View*/
#kn-report-view_1317-1

/*Report 2 in the View*/
#kn-report-view_1317-2

Lastly, if you have both a bar chart and pie chart next to each other where you want to match colors, there is one final thing that must be done. Navigate to the pie chart Chart Properties data section

Select the cog and set the legend order to be in reverse alphabetical

Counter-intuitive to what you would expect, doing this displays the pie chart legend in proper alphabetical order so the legend colors match the pie slice colors which in turn will match the bar chart colors if you apply the default HighChart colors.

More Info

Unfortunately Knack does not apply the default HighCharts colors for bar charts and only gives the bar elements the first blue color. To increase clarity when comparing charts, we manipulate each individual bar so that is matches its corresponding pie chart color. Below is the list of the .

None needed 😎 though we do use the

If you want to see more about in the Mozilla developer docs.

Default HighChart Colors
Global HighCharts Report Styling
:nth-child() Pseudo Class Selectors
Without matching colors
With matching colors; bars, pie slices, and pie legend