Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
holoviz
GitHub Repository: holoviz/panel
Path: blob/main/examples/reference/indicators/Number.ipynb
2012 views
Kernel: Unknown Kernel
import panel as pn pn.extension()

The Number is a value indicator providing a visual representation of a value, which may be colored according to provided thresholds.

Parameters:

For details on other options for customizing the component see the layout and styling how-to guides.

  • colors (list): Color thresholds for the Number indicator, specified as a tuple of the absolute thresholds and the color to switch to.

  • default_color (str, default='black'): The color of the Number indicator if no colors are provided

  • format (str, default='{value}'): A formatter string which accepts a {value}.

  • font_size (str, default='54pt'): The size of number itself.

  • nan_format str(str, default='-'): How to format nan values.

  • title_size (str, default='18pt'): The size of number title.

  • value (int or float): The value of the number indicator.


The Number indicator can be used to indicate a simple number and formatted as needed:

pn.indicators.Number(name='Failure Rate', value=10, format='{value}%')

If we want to specify specific thresholds at which the indicator changes color:

number = pn.indicators.Number( name='Failure Rate', value=72, format='{value}%', colors=[(33, 'green'), (66, 'gold'), (100, 'red')] ) pn.Row(number.clone(value=10), number.clone(value=42), number.clone(value=93))