In pie charts, series colors are not allowed to use colors saved in the module configuration.

Issue fork charts-3094417

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jdmoreno created an issue. See original summary.

jdmoreno’s picture

StatusFileSize
new1.17 KB

Added

jdmoreno’s picture

Status: Active » Needs review
andileco’s picture

Thanks, @jdmoreno. We actually used to have this feature (which works well for the Charts API), but we took it out due to a couple issues:

1) If you have a View where you're only plotting one field, there would only be one color selected in the View configuration, so you would have all the same colors for the pie slices.
2) The number of colors in default settings only goes up to 10, so if your pie has more than 10 slices, you run into an issue there as well.

Leaving the code you added out allows Highcharts to just do its own thing. Though I agree with you: it's not optimal.

Any ideas about how to address the two issues above?

jdmoreno’s picture

Hi @andileco, thanks for your answer, regarding point number one, the truth is that I have not had the opportunity to try it since this solution is mainly designed for the use of chart implementations by code.

With reference to point two, perhaps a button (add new color) could be implemented in the module configuration form, which adds a new color field by ajax and increases the array of colors with the new fields added by the user.

Regards.

jdmoreno’s picture

Hi @andileco, thanks for your answer, regarding point number one, the truth is that I have not had the opportunity to try it since this solution is mainly designed for the use of chart implementations by code.

With reference to point two, perhaps a button (add new color) could be implemented in the module configuration form, which adds a new color field by ajax and increases the array of colors with the new fields added by the user.

Regards.

jtriguero’s picture

Hi @andileco, @jdmoreno is my teammate, seems like he is not a confirmed user yet in drupal.org.

Here is his response.

"Hi @andileco, thanks for your answer, regarding point number one, the truth is that I have not had the opportunity to try it since this solution is mainly designed for the use of chart implementations by code.
With reference to point two, perhaps a button (add new color) could be implemented in the module configuration form, which adds a new color field by ajax and increases the array of colors with the new fields added by the user.
Regards."

andileco’s picture

Version: 8.x-3.x-dev » 5.0.x-dev
Assigned: jdmoreno » Unassigned

Moving this to 5.0.x. Fixing colors is hopefully my last release blocker.

rosk0’s picture

Status: Needs review » Needs work

Going back to the question sin #4:

  1. For the Views case - should leave out the color selection for this case completely? This would mean that library would need to assign the colors randomly right?
  2. The number of colors in default settings only goes up to 10

    - I can see some options here: 1) we allow for more colors; 2) we can add an option for user to ignore pre-set colors if the number slices (or other items requiring a color) is bigger then configured ; 3) combine previous two

nikathone made their first commit to this issue’s fork.

  • andileco committed cb7b8da on 5.0.x authored by nikathone
    Issue #3094417 by nikathone, jdmoreno: Highcharts pie default colors
    
andileco’s picture

Status: Needs work » Fixed

This patch enabled dynamic addition of new default colors. This, combined with other recent color-related commits should close this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.