Need a special offer?Find out if your project fits.
+

Can charts (pie slices or bars) colors got the same color for the same item in different instances?

Answered
Jean Teran asked on June 28, 2024

Hi, in my company we would like find a way to pre-update the chart color in order to our customers can recognize themselves between different instances of Flexmonster in same page, see the image to understand better.

In the attached image you could see the same company in two different graphs, in each graph the pie slice has a different color, is possible assign same colors by (for example) a company id?

Attachments:
Unknown.png

4 answers

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster July 2, 2024

Hello, Jean!

Thank you for reaching out to us.

Kindly note that it is possible to set the same colors for certain members in Flexmonster Pivot Charts using customizeChartElement API call.

The idea lies in the following:

  • Define the static colors that you like
  • Create a structure where each member from the chart would have the color hex attached to its caption. You can use our API calls, e.g., getReport() and getMembers(), to fetch the list of members.
  • Use the customizeChartElement function, which iterates chart elements and legend icons, to set predefined colors for each member.

We have prepared a JSFiddle example with a pie chart illustrating the idea: https://jsfiddle.net/flexmonster/t70fhonm/.

Hope you will find our answer helpful.

Kind regards,
Solomiia

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster July 10, 2024

Hello, Jean!

Hope you are having a great week.

Our team is wondering if you had some time to check our example with predefining chart colors for certain members. Could you please let us know if the suggested approach works well for your case?

Looking forward to hearing from you.

Kind regards,
Solomiia

Public
Jean Teran July 16, 2024

Thanks for your answer and sorry for my late answer, your response is sufficient to realize my tasks.

 

Thank you very much. 

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster July 17, 2024

Hello, Jean!

Thank you for your feedback.

We are glad to hear the suggested approach was helpful.

Feel free to reach out to us if any other questions arise.

Kind regards,
Solomiia

Please login or Register to Submit Answer