Colour Gradient on an Arc

asked May 21 in GUI Development by harbottle

We have a requirements to draw arcs that are shaded using a gradient. IE the colour at the start is A and the colour at the end of the arc is B.

If the angle increases, then start and end colour remain the same, but the gradient changes between the start and end.

Is this possible in EW?


1 Answer

0 votes
answered May 22 by Paul Banach


Embedded Wizard support for gradients is limited. Please see the section Specify the color of the stroked path. The support limits to a simple linear interpolation between four color values specified at the corners of the area enclosing an image (e.g. an area enclosing a drawn arc). Your approach expects an interpolation along the drawn path and is not supported. 

What you can do?

I assume you display the arc by using the Stroked Path view, right? In this case:

- replace the single Stroked Path view by 4 views arranged in two columns and two rows.

- Connect all 4 views to the same Path Data object containing the arc. All 4 views will thus display exact the same section of the arc.

- Adjust the Offset properties of each view individually, so the sections displayed in the views do compose the complete arc.

- Now you have 4 views. Each view can be configured with 4 individual color value. Since the views do connect at their edges, you have in total 9 color values you can individually specify for the image.

- Depending on the arc length you can calculate which colors should appear in which view. Calculate bthe colors and configure the views accordingly.

This is just a workaround. Without knowing your exact design it is difficult to say, whether it will work as expected. Can you provide a screenshot demonstrating the expected color gradient? 

Another approach would be to use images for this purpose. This means, you create the images with a graphic editor and import them in Embedded Wizard. In this case you need as many images as steps in the arcs. 

Best regards

Paul Banach

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint