I’m hoping someone can give me with the correct code to set a custom color for a segment of a pie chart using the servoy chart bean. It looks straight forward but everything I try is rejected. Although the sample CRM uses the pie chart it uses default colors and does not set them directly so no help there either
If I use…
elements.piechart.getColors(1)
``` to examine the standard colors used it seems to return a java Color object and I can use this to set another color, but again I have had no success with creating my own or indeed changing the RGB values that I can see in the Color object but cannot seem to access.
Has anybody done this? - help gratefully received as always!
Those beans are Java beans, and not “Servoy beans”. So it is most likely that they expect Java Color objects. Google for “Java awt color” and you will find resources that show you how to create a Java color.
Patrick - that’s more or less the conclusion I came to but I hadn’t had any luck in creating the java color object. I’ll look further and see if I can find the magic bit of code!
elements.bean_366.setColors(2000, new java.awt.Color(0xff0000)); // '#ff0000'
elements.bean_366.setColors(3000, new java.awt.Color(0x0000ff)); // '#0000ff'
elements.bean_366.setColors(4000, new java.awt.Color(0xff00ff)); // '#ff00ff'
elements.bean_366.setColors(5000, new java.awt.Color(0x0f0f0f)); // '#0f0f0f'