Custom Gage Widget Hack

Here is a neat little hack for how you can use SVGs and connector functions to make dynamic custom gages or images.



Code in NoCode Platform! Great Is it a SQL connector?

Yep! It is a sql connector that returns an image variable. The image itself is created within the function and can accept variables that help to define the size, color, or shape of the image.

1 Like

Hey everyone, just wanted to give a quick update - the new function STRING_TO_IMAGE_URL() within the expression editor makes it so you no longer need to use the connector to accomplish this.

1 Like

This is great and will allow so much more control for guys like me that focus more on the UX side of an app. Will this feature need to be enabled for each Tulip instance?

The release should happen automatically but the exact timing will be based on your instance.

Is it plan to explain in detail what we can do with new STRING_TO_IMAGE_URL() function() Which format will be support (base64, SVG, …)?

New features are documented in the support docs (Technical Details of the Expression Editor | Tulip Knowledge Base - Support for Building Operations Apps) but I like to push the features and the platform whenever possible. I would still generally regard the SVG and base64 stuff as a Hack. Personally though, I like hacks. I’m always impressed by what people come up with and I don’t think we’ve fully explored all that is possible. The simplicity, power, and diversity of the platform’s features make me wonder if we’ll ever fully document every possibility. The more we explore and share, the better.

For this, at least, I’ll be making an updated video that uses the expression editor (instead of the connectors demo) and exploring what can be done with it. What I’d like to continue to do is document as many tricks, tips, techniques, and solutions that I can and categorize them.

Are you sure that the STRING_To_IMAGE_URL function allows the conversion? My tests are not positive!

Sorry, it works! I use Image to Base64 | Base64 Encode | Base64 Converter | Base64 and convert in Data URI

Very cool discussion here Mark/Youri, I’m playing around to move simple shapes in my apps (without changing steps now !)


Hope it can spark cool idee here is the expression I’m using on the example above :

string_to_image_url(‘data:image/svg+xml,’ + @Variable.input_position_x + ‘%22%20y%3D%22’ + @Variable.input_position_y + ‘%22%20width%3D%22’ + @Variable.input_width + ‘%22%20height%3D%22’ + @Variable.input_height + ‘%22%20stroke%3D%22’ + @Variable.input_color_name + ‘%22%20fill%3D%22transparent%22%20stroke-width%3D%225%22%2F%3E%0A%0A%3C%2Fsvg%3E’)

1 Like

I just realized looking at r216 that we can encode a SVG code from the expression editor (with Encode_URI() ) so here is an app builder friendly expression :

string_to_image_url('data:image/svg+xml,' + encode_uri('<?xml version="1.0" standalone="no"?><svg width="200" height="250" version="1.1" xmlns="">  <rect x="' + @Variable.input_position_x  + '" y="' + @Variable.input_position_y  + '" width="' + @Variable.input_width  + '" height="' + @Variable.input_height  + '" stroke="' + @Variable.input_color_name  + '" fill="transparent" stroke-width="5"/></svg>'))

@freedman exciting and a bit of a game changer for ux design in Tulip, thanks for sharing! Is there any plan or hack to store the “value” of an image variable like this in a Tulip Table? Like in pte’s example above, except the image of the square is stored in a tulip table vs. a local app variable (and thus updates wherever referenced in other apps)? Thanks!


Interesting @aaronbroussard , I’d be curious what you had in mind here. I’m sure that would be very useful. I tried saving to a table and got an error so I just submitted a feature request.

It does seem to work in test / dev mode, but that doesn’t really help that much.

In the short term you could just store the raw text in a table and update the image variable from the tulip table on app open/step open or on a timer.


Does anyone know why gradients in an svg do not display? Most modern UX design styles such as Flat 2.0 and Neumorph rely heavily on gradients and it would be great have more options and abilities than just the drop shadow effect on text boxes and buttons.


@Jeff I think gradients do work. Check this out