Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
bcherbonneau
Partner - Contributor
Partner - Contributor

How to set custom color in ComboChart created in MashUp ?

Hi,

I have created a combochart in my mashup following this tutorial :

https://help.qlik.com/en-US/sense-developer/May2021/Subsystems/Mashups/Content/Sense_Mashups/Create/...

Is there a way to set a specific color for each measure, without using a global theme for the Qlik app ?

Thank you

Labels (2)
4 Replies
rankassovitz
Employee
Employee

Hi there,

In order to override the default theme color pallet, you will have to set the color properties of the chart from 'auto:true' to 'auto:false' & set 'mode: byMeasure'. This is what the property panel looks like in the native product:

cgu_2-1673627077002.png

 

From API perspective, it looks like this (same use case):

cgu_3-1673627178267.png

 

For more details read here:
https://help.qlik.com/en-US/sense-developer/May2021/Subsystems/Mashups/Content/Sense_Mashups/Create/... 

bcherbonneau
Partner - Contributor
Partner - Contributor
Author

Thank you for your reply.

 

From my understanding, mode: byMeasure allows to set colors depending on the measure value.

That’s not exactly what I want : I want to be able to change the color of all the values of one measure.

 

For example, if I have one set of bars, and one line, I would like to change the colors of :

- the bars : red (same color for all bars)

- the line : blue

 

That’s similar to the behavior when “Multicolored” is selected, except I want to customize the colors.

 

Thanks

rankassovitz
Employee
Employee

Now I understand your question better, thanks for clarifying.

What you need to do is

  1. Use master measures and define the color of those measures first
    cgu_0-1673636747566.png
  2. When defining comboChart from the property panel I can see that you can use "Multicolored" mode and  choose "Measure" under the "Use library colors" dropdown. That way it leverages the specific colors you set in step 1. See native property panel:
     cgu_1-1673637189510.png

    When examining the chart properties, you see that under color object -  auto:false, mode:"primary" (also try mode:"multicolored" instead) and useBaseColors:"measure"

    cgu_2-1673638224339.png

     

bcherbonneau
Partner - Contributor
Partner - Contributor
Author

Hi,

Thank you for your time.

Sadly, this is not an option for me, since that would force me to create one master measure for each chart.

I guess I should add more context to what I’m trying to achieve :

  • My initial goal was to display the “same” chart several times (10+), each time having a specific set of filters applied to it
  • Since filters are global in Qlik, I can’t achieve this using only one item
  • This means I would have to create n times the same chart, with a different filter each time
  • To avoid this (and the maintenance cost it would incur) I had the idea to instead create objects on-the-fly in the mashup, which works great
    • To be more exact, I use a variable to generate the chart measure formulas, passing the filter values I want as parameters
  • BUT in this case, I can’t use master measures (correct me if I’m wrong on this one)

 

I’ve managed to replicate the original object configuration/appearance, it only lacks the colors now…

I have also tried to set the “color” property for the measures (set inline in the “cols” of the combochart), but this didn’t seem to do anything.

See https://help.qlik.com/en-US/sense-developer/May2022/Subsystems/APIs/Content/Sense_ClientAPIs/Capabil...

If there is an alternative way to achieve what I’m trying to do, I will gladly take it !

Thank you