Guest adieldar Posted January 17, 2023 Posted January 17, 2023 Azure Data Explorer (ADX) supports various types of data visualizations including time, bar and scatter charts, maps, funnels and many more. The chosen visualization can be specified as part of the KQL query using ‘render’ operator, or interactively selected when building ADX dashboards. Today we extend the set of visualizations, supporting advanced interactive visualizations by Plotly graphics library. Plotly supports ~80 chart types including basic charts, scientific, statistical, financial, maps, 3D, animations and more. There are two methods for creating Plotly visuals: Write your own visualization in Python In this method the Python script is run on the existing ADX nodes using the inline python() plugin. It generates a Plotly JSON that is rendered by the client application. Pros: All types of Plotly visualizations are supported. Full customization tailored to the specific scenarios. As the script runs on the server side, it can efficiently process big amounts of data to create the visualization. Cons: Requires enabling the python() plugin on ADX cluster. To create the visualization the user needs to know the Python language and Plotly API. Use a pre-prepared Plotly template In this method a pre-prepared Plotly JSON for specific visualization can be reused by replacing the data objects with the required data to be rendered. The templates can be stored in a standard ADX table, and the data replacement logic can be packed in a stored function. Pros: Supported on all ADX clusters (as there is no need to enable the python() plugin). No need for Python programming. Cons: Limited set of visualization types are supported. Only minimal customization is supported (limited to the template parameters). Creating additional templates is somewhat complex. We already published 2 templates - plotly_anomaly_fl() and plotly_scatter3d(), both allow interactive operations (zooming, panning, rotating, capturing etc.) and we continue to extend the templates library - you are welcome to contribute your own cool templates! Here are screen captures of both anomaly chart and 3D scatter chart: Here is the KQL query to generate this 3D scatter chart using Python: Iris | evaluate python(typeof(plotly:string), ```if 1: import plotly.express as px fig = px.scatter_3d(df, x='SepalLength', y='SepalWidth', z='PetalLength', color='Class') fig.update_layout(title=dict(text='3D scatter chart using Plotly')) plotly_obj = fig.to_json() result = pd.DataFrame(data = [plotly_obj], columns = ['plotly']) ```) And here is the query to generate the same 3d scatter chart using the stored function plotly_scatter3d() that modified the Plotly template: Iris | invoke plotly_scatter3d_fl(x_col='SepalLength', y_col='PetalLength', z_col='SepalWidth', aggr_col='Class', chart_title='3D scatter chart using Plotly') For further information have a look at Customize Azure Data Explorer dashboard visuals | Microsoft Learn. Note that currently Plotly visuals are supported only in ADX dashboards, in a few weeks they will be supported in Kusto Web Explorer too. Stay tuned and share your feedback! Continue reading... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.