Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]Coloring bars different colors when plotting 2 series #1198

Open
1 task
divyansh997 opened this issue Dec 15, 2022 · 2 comments · May be fixed by #1265
Open
1 task

[Question]Coloring bars different colors when plotting 2 series #1198

divyansh997 opened this issue Dec 15, 2022 · 2 comments · May be fixed by #1265

Comments

@divyansh997
Copy link

Issue Category

  • Question

Product Versions

  • Please specify what version of the library you are using......: [3.11.0]
  • Please specify what web browser you are using.................: [ Chrome ]

Desired Behavior

When plotting two series bar charts, how do I color the bars individually of different colors?

What I want to achieve is this -

image

I have achieved this -

image

Steps to Reproduce

I tried coloring the bars individually by passing in two arrays inside an array for param chartColors like so -

slide.addChart(pptx.ChartType.bar, data,
        {
          x: 0.15, y: 1.4, w: 8, h: 3.7,
          layout: { x: 0.3, y: 0.05, w: 1, h: 0.8 },
          barDir: "col",
          barGapWidthPct: 80,
          barOverlapPct: 50,
          chartColors: [['e5e5e5'], ['7a86cc', '4ed1e1', '83c786', '7a86cc']],
        });

This does not work, I also tried passsing it as a single array chartColors: ['e5e5e5', '7a86cc', '4ed1e1', '83c786', '7a86cc'] but that does not work either. The second series always picks up the color at index 1('7a86cc') and that color remains for the whole series.
Is this currently supported? And if yes how do i pass the chartColors for it? I couldn't find any relevant documentation for this specific use-case. Thanks!

@divyansh997 divyansh997 changed the title [FEATURE] Coloring bars different colors when plotting 2 series Dec 15, 2022
@divyansh997 divyansh997 changed the title Coloring bars different colors when plotting 2 series [Question]Coloring bars different colors when plotting 2 series Dec 15, 2022
@leograde
Copy link

leograde commented May 24, 2023

From my understanding, if you have only 1 series then each color of the chartColors represents each data item of that series. If you have more than 1 series, then each color of the chartColors represents all data items of that series.

I also have a use case where I would like to choose different colors within each of my series. Is there any update on this?

@dustinfarris
Copy link

would also love to understand how to do this. i've tried creating a combo chart to achieve it, but it's not working that well.

@dustinfarris dustinfarris linked a pull request Jun 20, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants