Problem/Motivation

This issue enabled use of the grouping feature in Views: https://www.drupal.org/project/charts/issues/3207514. However, this solution is incompatible with the color-picker currently in place in the data provider section of the (Views) chart format settings form.

There are other situations in which the current color model doesn't work, particularly pie/donut charts.

Proposed resolution

  1. Create a color-selection for that appears when a grouping field is selected or when a pie chart is selected.
  2. Support this on the back end by using a utility that determines available values to be assigned a color.

Issue fork charts-3251123

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

andileco created an issue. See original summary.

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

  • andileco committed 05bedda on 5.0.x authored by nikathone
    Issue #3251123 by nikathone, andileco: Create interface for selecting...
andileco’s picture

Status: Active » Fixed

Tested and it's working great!

it-cru’s picture

@andileco & @nikathone: Hello together, I can't figured out yet, how to configure this in my Charts (with Chart.js) view with pie or donut.

I have a view where I count a true/false field on my entities and wanted to display the result as a pie or donut chart with green and red colors. Currently my view is using aggregation for this count, but maybe this is not the right way anymore.

Previously I've used views_simplechart module for this where it was working out of the box with this views configuration, but I switched this project yesterday from an old D8 to D9 and replaced views_simplechart with charts module.

Will be nice if one of you or someone else could give me a little hint for a Charts module newbie ;)

andileco’s picture

Hi @IT-Cru. I think you *should* have already been able to do this by selecting "no label" for the label field and then selecting "True" and "False" as data providers and assigning each a color (assuming to have a Views field representing/summing each). I know this is not documented anywhere because I just discovered how to do this when chatting with @nikathone.

That said, you are right that this issue needs to be updated to focus more on the grouping aspect. We felt we may need to separate out the pie/donut issue into a separate one after completing the first part of the task, but had not updated the ticket yet.

Status: Fixed » Closed (fixed)

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