GETTING STARTED | DATA VISUALIZATION | KNIME ANALYTICS PLATFORM
Create an Interactive Dashboard with KNIME Components and Python
TL;DR: KNIME can be used to easily create dashboards which also let you download the results as individual PNG and Excel files
Just show me the Data App workflows:
- KNIME & Python Graphics — Boxenplot Plotting large distributions — using the bundled Python integration
- Build a small interactive dashboard based on data selections with the Refresh button in KNIME
- Simple workflow to select and export data in a dashboard
- Example using the new Python View nodes
- Python graphics interactive — Time Series Grouped Interval
- Set parameters for a Matplotlib chart with the help of KNIME Data Apps (Lineplot)
- Create a Data App with a dynamic filter derived from a categorical column
- List Files CSV and Import them via Data App
You can use KNIME to quickly create interactive dashboards with your favourite low-code tool. With the bundled Python integration attractive graphics are easy to create and configure with minimal additional coding.
If you are interested in Data Apps and widgets in general I have several links at the end of this article. If you are more into videos there is my talk about “Advanced Visualizations with Python and KNIME also building a Data App” on YouTube:
In the first example, we have a database of Diamonds with their size and quality and try to explore the data with a small table of filtered results and a graphic that can be configured right within the workflow.
Numeric and string variables are extracted and can be fed to the Component and be presented to select the values and the categories. The selection will be used to filter the data (Cut = Premium) and then select the numeric variable (price) from which the TOP 10 values will be shown. You could feed your own data to the nodes and the extraction will be done dynamically.
The selected string variable (cut) will be used to group the numeric variable (price) and display the values in a Boxplot graphic which will directly be shown within the Component. The results will also be converted to a PNG file in the background and stored in a temporary folder to get an (individual) name with the current timestamp attached. The PNG file can then be downloaded from the component along with the selected TOP 10 values into an Excel file. You could of course adapt that and create your own table of results with other KNIME nodes (like GroupBy) and other graphics.
Key to the functions is the Refresh Button which appears as the (yellow) “Execute” button in the figure above. Within the component, all functions are built using KNIME nodes. The widgets provide the dynamic elements and the refresh button would bring all that together and make it interactive.
The widgets are also used to fill the interface of the Component. One small button on the top opens up the “Composite View Layout” where you can create and edit how your interface will look like. You can have static and dynamic elements and also present graphics or data as tables.
The components can be opened directly from the KNIME workflow, but they can also work as a web application if you start the workflow from the KNIME Business Hub. In this case, your users would not need their own KNIME version installed locally. You can build dashboards and data science tools with the whole of KNIME functions in the background — you also could use traditional programming languages like R and Python.
Another approach exploring the Diamonds dataset is creating a “Scatterplot with Trend-Line and Statistics”. If you want to learn more about this little widgets in the Data Apps you can read: “Explore the Wonderful World of KNIME Widgets”.
Use Python graphic packages like Seaborn and Matplotlib
If you want to go one step further, you can combine this approach with the bundled Python version in KNIME which comes with these graphic packages Matplotlib and Seaborn already included — you will just have to install the extension and would not have to deal with all Conda environments and stuff.
However, if you want to learn more about how to set up Python and KNIME you can see my Medium article “KNIME and Python — Setting up and managing Conda environments”.
Again we can select the variables to be used in the graphic but this time the graphic will be produced by a Python Script node. The variables created will be fed into a Python code framework which might just be adapted from existing Seaborn examples.
So while you have to deal with some code, you will not have to write everything on your own and you can easily adapt existing examples by simply filling in some KNIME Flow Variables with the “knio.flow_variables[…]” function from the KNIME/Python packages installed automatically with the extension.
You have to deal with the Python code just once and your users won’t have to deal with it at all. And as you can see with several other examples of Python graphics on the KNIME Community Hub, you can adapt a wide range of graphics.
If you enjoyed this story you can also follow me in the KNIME forum and on the KNIME Community Hub with much more examples (https://hub.knime.com/mlauber71)
- Blog: Eight Data App Designs with the New Refresh Button
- Explore the Wonderful World of KNIME Widgets
- Build an Interactive Data App in 3 Steps
- KNIME Components Guide
- Metanode or Component — What’s the Difference?
- KNIME Analytics Platform: Components are for Sharing
- Exploring the Power of Python Graphics with KNIME: A Collection of Examples