Skip to content
  • Home
  • Work
  • About
  • Blog
  • Contact

Setting a Radial Gradient Stop Position in Visio

John Goldsmith's profile image

John Goldsmith

06 April 2022
  • ShapeSheet
  • Themes, Styles and Formatting

Visio Linear Gradient

This is a quick post on how radial gradient stops work in Visio.

In Visio, gradient stop positions are set as a percentage value:

Visio Gradient Stops

If you're applying a linear gradient then that percentage is a position on virtual ray that has a start and end point and is determined by the FillGradientAngle. So the following image shows a linear gradient with two stops (a white one at 0% and a blue one at 100%) and an angle of 0 degrees (shown by the orange arrow):

Visio Linear Gradient

For a radial gradient the FillGradientAngle is not used and the start end points are determined based on the value of the FillGradientDir cell. Setting a value of 3 sets the begin point to the center of the shape and the end point becomes the corner of the shape.

Here's a shape that demonstrates this and uses a (yellow) control handle to set the gradient position. (I've also added another orange arrow to show the direction of the gradient ray)

Visio Radial Gradient

Just in case you're wondering where the gradient part is in these solid colours, I've set adjoining stops to the same values, which produces a hard transition (ie no gradient). This is useful a) to see where the stop positions actually are and b) as a technique to allow for multiple colours in a single shape. You can see another example of this in a traffic light post I did a little while ago.

The stops in the above shape are defined as follows:

Visio Coincident Gradient Stops

...and then User.PathPercentage is calculated by taking input from the Control handle, pushing it into the User.RawX/Y cells, working out the radius and angle and then using those values (User.CalcX/Y) back in the Control handles. Here's the Control handle's XY cells:

Visio Users cells to allow Control to track along diagonal path Visio Users cells to allow Control to track along diagonal path

The result is that you can change the position of the stops via a control handle in the shape:

Visio Users cells to allow Control to track along diagonal path

One caveat to bear in mind is that you cannot lock gradient stops so you run the risk of users either deleting or overwriting the stops via the controls in the UI. One option to protect them is to lock formatting of the whole shape using the LockFormat cell. It would be great to have a LockFillGradientStops but alas that doesn't exist currently.

And finally, a very handy tip from Chris Roth - if you're having trouble selecting gradient stops that are close together in the UI, you can use the arrow keys to navigate between them, allowing you to not mess up the positions but set all of the other stop properties.

Microsoft MVP Logo

John has been a Microsoft MVP, in the award categories of Visio and M365, since 2008.

Visio Blogs

  • Bill Morein (via Wayback Machine)
  • Chris Castillo (via Wayback Machine)
  • Chris Hopkins (via Wayback Machine)
  • David Parker
  • Eric Rockey
  • Jesse Phillips-Mead
  • John Marshall
  • Michel LAPLANE (FR)
  • Nikolay Belyh
  • Saveen Reddy (via Wayback Machine)
  • Visio Guy
  • Visio [Product] Blog
  • Visio Insights (via Wayback Machine)

Visio Resources

  • Developing Microsoft Visio Solutions
  • Visio Stencils at ShapeSource
  • Microsoft Visio YouTube Playlist
  • Visio (Product site)
  • Office 2010 Engineering
  • Visio 2016 SDK (Download)
  • Visio JavaScript API reference
  • VisioMVPs.org
Contact

visualSignals ltd
31 Riverview Grove
London, W4 3QL
United Kingdom

+44 (0) 208 078 9120

Around the Web

Copyright © visualSignals ltd 2025

Mastodon