localgovdrupal / localgov_elections

This module provides submodules, content types, views and configuration that allow the reporting of election results for the LocalGov Drupal distribution.
GNU General Public License v2.0
1 stars 1 forks source link

Parties sometimes have wrong colour in chart #98

Closed chriswales95 closed 4 months ago

chriswales95 commented 4 months ago

This is because of dodgy code I wrote a while back I think.

Due to how charts js works, the labels, data, and background colour arrays are seperate and are not bundled together. We match them to the users colours by comparing the labels and whatnot. The colours are injected from the Drupal backend into the frontend.

Due to the faulty logic, the background colour array wasn't kept in line with the data and labels array. This meant that they became out of sync if there was a blank entry.

PR incoming.