Panel Widgets¶
Range slider¶
- panel_widgets.range_slider(width=400, height=20, data_points=None, step_size=None, step_size_type=<class 'int'>, **params)¶
Widget in the navbar of the cuxfilter dashboard.
Type: Range Slider
- Parameters:
- x: str
column name from gpu dataframe
- width: int, default 400
- height: int, default 20
- data_points: int, default None
when None, it means no custom number of bins are provided and data_points will default to df[self.x].nunique()
- step_size: int, default 1
- step_size_type: {int, float}, default int
- **params:
additional arguments to be passed to the function. See panel documentation for more info
Example¶
import cudf
from cuxfilter import charts, DataFrame
import cuxfilter
cux_df = DataFrame.from_dataframe(cudf.DataFrame({'key': [0, 1, 2, 3, 4], 'val':[float(i + 10) for i in range(5)]}))
range_slider = charts.range_slider('key')
d = cux_df.dashboard([range_slider])
range_slider.view()
Date Range slider¶
- panel_widgets.date_range_slider(width=400, height=20, data_points=None, **params)¶
Widget in the navbar of the cuxfilter dashboard.
Type: Range Slider
- Parameters:
- x: str
column name from gpu dataframe
- width: int, default 400
- height: int, default 20
- data_points: int, default None
when None, it means no custom number of bins are provided and data_points will default to df[self.x].nunique()
- step_size: np.timedelta64, default np.timedelta64(days=1)
- **params:
additional arguments to be passed to the function. See bokeh DateRangeSlider documentation for more info
Example¶
import cudf
from cuxfilter import charts, DataFrame
cux_df = DataFrame.from_dataframe(cudf.DataFrame({'time':['2020-01-01', '2020-01-10 01', '2020-02-20 22']}))
cux_df.data['time'] = cudf.to_datetime(cux_df.data['time'])
date_range_slider = charts.date_range_slider('time')
d = cux_df.dashboard([date_range_slider])
date_range_slider.view()
Float slider¶
- panel_widgets.float_slider(width=400, height=40, data_points=None, step_size=None, **params)¶
Widget in the navbar of the cuxfilter dashboard.
Type: Float Slider
- Parameters:
- x: str
column name from gpu dataframe
- width: int, default 400
- height: int, default 40
- data_points: int, default None
when None, it means no custom number of bins are provided and data_points will default to df[self.x].nunique()
- step_size: float, default float((max - min)/datapoints)
- **params:
additional arguments to be passed to the function. See panel documentation for more info
Example¶
import cudf
from cuxfilter import charts, DataFrame
cux_df = DataFrame.from_dataframe(cudf.DataFrame({'key': [0, 0.5, 1, 1.5, 2], 'val':[float(i + 10) for i in range(5)]}))
float_slider = charts.float_slider('key', step_size=0.5)
d = cux_df.dashboard([float_slider])
float_slider.view()
Int slider¶
- panel_widgets.int_slider(width=400, height=40, data_points=None, step_size=1, **params)¶
Widget in the navbar of the cuxfilter dashboard.
Type: Int Slider
- Parameters:
- x: str
column name from gpu dataframe
- width: int, default 400
- height: int, default 40
- data_points: int, default None
when None, it means no custom number of bins are provided and data_points will default to df[self.x].nunique()
- step_size: int, default 1
- **params:
additional arguments to be passed to the function. See panel documentation for more info
Example¶
import cudf
from cuxfilter import charts, DataFrame
cux_df = DataFrame.from_dataframe(cudf.DataFrame({'key': [0, 1, 2, 3, 4], 'val':[float(i + 10) for i in range(5)]}))
int_slider = charts.int_slider('val')
d = cux_df.dashboard([int_slider])
#view the individual int_slider chart part of the dashboard d
int_slider.view()
Dropdown¶
- panel_widgets.drop_down(width=400, height=50, **params)¶
Widget in the navbar of the cuxfilter dashboard.
Type: drop_down
- Parameters:
- x: str
column name from gpu dataframe
- width: int, default 400
- height: int, default 50
- data_points: int, default number of unique values
- **params:
additional arguments to be passed to the function. See panel documentation for more info
Example¶
import cudf
from cuxfilter import charts, DataFrame
cux_df = DataFrame.from_dataframe(cudf.DataFrame({'key': [0, 1, 2, 3, 4], 'val':[float(i + 10) for i in range(5)]}))
drop_down = charts.drop_down('val')
d = cux_df.dashboard([drop_down])
#view the individual drop_down chart part of the dashboard d
drop_down.view()
Multiselect¶
- panel_widgets.multi_select(width=400, height=200, **params)¶
Widget in the navbar of the cuxfilter dashboard.
Type: multi_select
- Parameters:
- x: str
column name from gpu dataframe
- width: int, default 400
- height: int, default 200
- data_points: int, default number of unique values
- **params:
additional arguments to be passed to the function. See panel documentation for more info
Example¶
import cudf
from cuxfilter import charts, DataFrame
cux_df = DataFrame.from_dataframe(cudf.DataFrame({'key': [0, 1, 2, 3, 4], 'val':[float(i + 10) for i in range(5)]}))
multi_select = charts.multi_select('val')
d = cux_df.dashboard([multi_select])
#view the individual multi_select chart part of the dashboard d
multi_select.view()
Number Chart¶
- panel_widgets.number(expression=None, aggregate_fn='mean', title='', widget=True, format='{value}', colors=[], font_size='18pt', **library_specific_params)¶
Number chart which can be located in either the main dashboard or side navbar.
Type: number_chart or number_chart_widget
- Parameters:
- x: str
column name from gpu dataframe
- expression:
string containing computable expression containing column names e.g: “(x+y)/2” will result in number value = (df.x + df.y)/2
- aggregate_fn: {‘count’, ‘mean’, ‘min’, ‘max’,’sum’, ‘std’}, default ‘count’
- title: str,
chart title
- widget: bool, default True
if widget is True, the chart gets placed on the side navbar, else its placed in the main dashboard
- format: str, default=’{value}’
A formatter string which accepts a {value}.
- colors: list
Color thresholds for the Number indicator, specified as a tuple of the absolute thresholds and the color to switch to. e,g: colors=[(33, ‘green’), (66, ‘gold’), (100, ‘red’)]
- font_size: str, default ‘18pt’
- **params:
additional arguments to be passed to the function. See panel documentation for more info
Example 1¶
import cudf
from cuxfilter import charts, DataFrame
cux_df = DataFrame.from_dataframe(cudf.DataFrame({'key': [0, 1, 2, 3, 4], 'val':[float(i + 10) for i in range(5)]}))
number_chart = charts.number(x='val', aggregate_fn="mean", format="{value}%")
d = cux_df.dashboard([number_chart])
# view the individual number_chart chart part of the dashboard d
number_chart.view()
Example 2¶
import cudf
from cuxfilter import charts, DataFrame
cux_df = DataFrame.from_dataframe(cudf.DataFrame({'key': [0, 1, 2, 3, 4], 'val':[float(i + 10) for i in range(5)]}))
number_chart = charts.number(
expression='(key*val)*1000', aggregate_fn="mean",
title="custom eval expr",
format="{value:,}", font_size="20pt"
)
d = cux_df.dashboard([number_chart])
# view the individual number chart part of the dashboard d
number_chart.view()
Card Chart¶
- panel_widgets.card(title='', widget=True, **library_specific_params)¶
Card chart contating markdown content and can be located in either the main dashboard or side navbar.
Type: number_chart or number_chart_widget
- Parameters:
- content: {str, markdown static content}, default “”
- title: str,
chart title
- widget: bool, default True
if widget is True, the chart gets placed on the side navbar, else its placed in the main dashboard
- **params:
additional arguments to be passed to the function. See panel documentation for more info
Example¶
import cudf
from cuxfilter import charts, DataFrame
import panel as pn
cux_df = DataFrame.from_dataframe(cudf.DataFrame({'key': [0, 1, 2, 3, 4]}))
card_chart = charts.card(pn.pane.Markdown("""
# H1
## H2
### H3
#### H4
##### H5
###### H6
### Emphasis
Emphasis, aka italics, with *asterisks* or _underscores_.
"""), title="Test Markdown title")
d = cux_df.dashboard([card_chart])
# view the individual card_chart chart part of the dashboard d
card_chart.view()