Color Function
- bar(x, width)
Description: Renders a single bar in the ANSI bar chart using the default low-frequency red and high-frequency green. For example, if you pass 25% of x and 40 widths to this function. A 10-character red bar followed by 30 spaces will be drawn to create a 40-character bar.
- bar(x, width, low_color, high_color)
Description: Draws a straight line with the specified width in an ANSI bar chart. The x parameter is a double-precision value ranging from 0 to 1. If the value of x is out of the range [0,1], the value is truncated to 0 or 1. low_color and high_color capture the color at either end of the horizontal bar chart. For example, if x is 0.5, width is 80, low_color is 0xFF0000, and high_color is 0x00FF00, this function returns a 40-character bar. The bar consists of red (0xFF0000) and yellow (0xFFFF00), the remaining 80 characters are padded with spaces.
select bar(0.75,80,rgb(255,0,0),rgb(0,255,0));
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot