Trend#

This component is also available in the classic reference.

The Trend indicator enables the user to display a dashboard kpi card.

Use pn.ui.Trend to create this component.

API#

.. py:class:: Trend(*, data, layout, neg_color, plot_color, plot_type, plot_x, plot_y, pos_color, value_change, selection, disabled, loading, align, aspect_ratio, css_classes, design, height, height_policy, margin, max_height, max_width, min_height, min_width, sizing_mode, styles, stylesheets, tags, visible, width, width_policy, label, value, name) :module: panel.widgets.indicators

The Trend indicator enables the user to display a dashboard kpi card.

The card can be layout out as:

  • a column (text and plot on top of each other) or a row (text and

  • plot after each other)

Reference: https://panel.holoviz.org/reference/indicators/Trend.html

:Example:

data = {‘x’: np.arange(50), ‘y’: np.random.randn(50).cumsum()} Trend(label=’Price’, data=data, plot_type=’area’, width=200, height=200)

:Attributes:

   **data**
       ..

   **sizing_mode**
       ..

.. !! processed by numpydoc !!

Parameter Definitions


Parameters inherited from:

   :class:`panel.viewable.Layoutable`: align, aspect_ratio, css_classes, design, min_width, min_height, max_width, max_height, styles, stylesheets, tags, width_policy, height_policy, visible

   :class:`panel.viewable.Viewable`: loading

   :class:`panel.widgets.base.Widget`: height, margin, width, disabled

   :class:`panel.reactive.SyncableData`: selection

label = String(default='', label='Label') The label or a short description of the card.

value = Parameter(default='auto', label='Value')

  The primary value to be displayed.

sizing_mode = Selector(label='Sizing mode', names={}, objects=['fixed', 'stretch_width', 'stretch_height', 'stretch_both', 'scale_width', 'scale_height', 'scale_both', None])

    How the component should size itself.

    This is a high-level setting for maintaining width and height
    of the component. To gain more fine grained control over
    sizing, use ``width_policy``, ``height_policy`` and
    ``aspect_ratio`` instead (those take precedence over
    ``sizing_mode``).

    ``"fixed"``
        Component is not responsive. It will retain its original
        width and height regardless of any subsequent browser
        window resize events.

    ``"stretch_width"``
        Component will responsively resize to stretch to the
        available width, without maintaining any aspect ratio. The
        height of the component depends on the type of the
        component and may be fixed or fit to component's contents.

    ``"stretch_height"``
        Component will responsively resize to stretch to the
        available height, without maintaining any aspect
        ratio. The width of the component depends on the type of
        the component and may be fixed or fit to component's
        contents.

    ``"stretch_both"``
        Component is completely responsive, independently in width
        and height, and will occupy all the available horizontal
        and vertical space, even if this changes the aspect ratio
        of the component.

    ``"scale_width"``
        Component will responsively resize to stretch to the
        available width, while maintaining the original or
        provided aspect ratio.

    ``"scale_height"``
        Component will responsively resize to stretch to the
        available height, while maintaining the original or
        provided aspect ratio.

    ``"scale_both"``
        Component will responsively resize to both the available
        width and height, while maintaining the original or
        provided aspect ratio.

data = Parameter(allow_None=True, label='Data')

  The plot data declared as a dictionary of arrays or a DataFrame.

layout = Selector(default='column', label='Layout', names={}, objects=['column', 'row'])

    The layout of the indicator, either a column (text and plot on top of each other)
    or a row (text and plot after each other).

plot_x = String(default='x', label='Plot x')

  The name of the key in the plot_data to use on the x-axis.

plot_y = String(default='y', label='Plot y')

  The name of the key in the plot_data to use on the y-axis.

plot_color = String(default='#428bca', label='Plot color')

  The color to use in the plot.

plot_type = Selector(default='bar', label='Plot type', names={}, objects=['line', 'step', 'area', 'bar'])

  The plot type to render the plot data as.

pos_color = String(default='#5cb85c', label='Pos color')

  The color used to indicate a positive change.

neg_color = String(default='#d9534f', label='Neg color')

  The color used to indicate a negative change.

value_change = Parameter(default='auto', label='Value change')

  A secondary value. For example the change in percent.

.. py:attribute:: Trend.sizing_mode :module: panel.widgets.indicators :type: t.Literal[‘fixed’, ‘stretch_width’, ‘stretch_height’, ‘stretch_both’, ‘scale_width’, ‘scale_height’, ‘scale_both’] | None :value: None