Create DataBar conditional formatting in Calc by macro

Need help creating a DATABAR conditional format for a cell using macro. Needed to set up the color and range of values

There are pitfalls - see this topic.