Developer Blog

Data Science |

Build a Fully Interactive Dashboard in a Few Lines of Python

Work continues on improving the UX and capabilities of our GPU cross-filter dashboard library, cuxfilter. Here is a quick recap of its latest features. 

First, it is as easy as ever to access cuxfilter. Just run a standard RAPIDS install as shown in the getting started page. Additionally, you can try it online at PaperSpace. One of the powerful benefits of a full RAPIDS installation means you can work on your data and visualize it within a single jupyter notebook or lab instance.

 Figure 1: Using cuxfilter to build a full interactive dashboard in a few lines of Python.

Here is a list of some of the major feature highlights:

  • High-density scatter, line, heatmap, and graph charts through Datashader. Also, choropleth maps from Deck.gl, and bar and line charts from bokeh.
  • A fully responsive, customizable layout with a widget side panel.
  • Themes, such as the dark one shown preceding. 
  • A preview feature using await d.preview() that generates a .png image of the full dashboard inline with your notebook.
  • Ability to export the selected data in an active dashboard by using the d.export() call. 
  • Ability to deploy as a standalone application (outside of a notebook), as explained in our documentation for deploying multiuser dashboards.

You can try all these and more features in our tutorial notebook, and follow along in our tutorial video. The screenshot shown in figure 2 is one of the dashboards created. A compelling example of how to combine RAPIDS libraries together to quickly create powerful cross-filterable dashboards in just a few lines of python.

Figure 2: Screenshot of double graph dashboard from gist below
# Dashboard
# Full example from https://github.com/rapidsai-community/showcase/tree/main/team_contributions/cuxfilter-tutorial
# Data
cux_df = cuxfilter.DataFrame.load_graph((final_df, edges))
# Charts
chart1 = cuxfilter.charts.graph(
edge_source='src', edge_target='dst',
edge_color_palette=['gray', 'black'],
ode_pixel_shade_type='linear',
edge_render_type='curved', #curved, direct
edge_transparency=0.6, #0.1 - 0.9
title='ForceAtlas2 Graph'
)
chart2 = cuxfilter.charts.scatter(
x='x_original', y='y_original',
tile_provider='CARTODBPOSITRON',
point_size=4,
pixel_shade_type='linear',
pixel_spread='spread',
title='Scatter Layout'
)
chart3 = cuxfilter.charts.bar('hour', title='Trips per hour')
chart4 = cuxfilter.charts.bar('from_station_id', title='Source station')
chart5 = cuxfilter.charts.bar('to_station_id', title='Destination station')
# Widgets
widget1 = cuxfilter.charts.multi_select('year')
widget2 = cuxfilter.charts.multi_select('day_type', label_map={0:'weekday', 1:'weekend', '':'all'})
# Layout Grid
layout_array_3rds = [[1,1,2],[1,1,2],[3,4,5]]
# Generate Dashboard
d = cux_df.dashboard([chart1, chart2, chart3, chart4, chart5],
sidebar=[widget1, widget2],
layout_array = layout_array_3rds,
theme=cuxfilter.themes.rapids,
title="Network and Geospatial Graph")
# Show
d.show()
view raw cuxfilter-dash.py hosted with ❤ by GitHub

Going forward, we continue to improve cuxfilter and use it to collaborate with the enormous python viz community, such as bokeh, holoviews, panel, and datashader projects. We encourage you to try it out, and as always, if you have any issues with feature requests, let us know on our GitHub. Happy cross-filtering!

Resources:

This post was originally published on the RAPIDS AI Blog.