Skip to content

Visualize Scratchpad Results

This page describes how to plot the results of your queries and code as a chart in the Visual tab of the output panel, and how to configure the chart.

The Visual tab plots query output as a chart.

  • You can choose between Bubble, Line or Bar charts, from the y-axis settings.
  • Visual settings give you options to configure the features of your chart.

This page covers charts in the Query window. If you use the kdb VS Code extension, refer to Plot with matplotlib.

The following example shows query results displayed in a bubble chart.

Bubble chart of results.

The following table defines the data display options:

Setting Description
First Displays results from the start of the data source (page 1).
Last Displays results from the end of the data source (last page).
Random Selects a random point in the data set to display results.
# of results drop-down Select how many results to show per page.

Visual settings

You can define the following settings using the Visual settings menu. Click the toggle button to display/hide the settings menu, and click on each setting to expand the options available.

X-Axis settings

The X Axis Settings define the x-axis data variables to chart and how they are formatted and displayed.

X-axis settings

You can configure the following settings:

  • Data Point: The data column to plot on the x-axis of the chart. Select from the dropdown to change the value.
  • Number of Ticks: The number of tick labels to display in the x-axis.
  • Range
  • Gridlines
  • Format

Range

Setting Description Default
Use min max Enable the use of Min and Max to build the axis. If these are unchecked the Min and Max values, set below, are ignored. Disabled
Min Define the minimum value for the axis.
Max Define the maximum value for the axis. Charted data outside of the set Min and Max range is not displayed. If all data falls outside the set range, the chart is blank.

Gridlines

Setting Description Default
Offset Gridlines When enabled, sets gridlines between tick values. Disabled
Gridlines Color Set the color of the gridlines used in the chart. #000000
Gridlines Opacity Defines the opacity of gridlines from 0 (transparent) to 100 (opaque). 15

Format

Setting Description Default
Display When enabled (for x-axis), displays tick values. Enabled for x-axis.
Begin at Zero When enabled, plotted values start at 0 for the x or y-axis. Disabled
Numeric Format Select between Number, Smart Number and Formatted Number. Numeric
Decimal Places Define precision of y-axis labels. 2
Font size Define font-size of tick labels. 12
Prefix Add a text element before the y-axis label.
Suffix Add a text element after y-axis tick label.
Hide Trailing Zeroes When enabled, trailing zeroes are hidden from axis labels. Disabled

Y-Axis Settings

The left and right Y Axis Settings define the data variables to chart and how they are formatted and displayed.

Y-axis settings

You can configure the following settings:

  • Enabled: The left y-axis is enabled by default. The right y-axis is disabled by default. Enable it to have two y-axes on your chart.
  • Data Point: The data columns to plot on this y-axis of the chart. Select single or multiple columns from the dropdown to change the value.
  • Chart Type: Select one of the following chart types: Bubble, Line or Bar. You can set a different chart type for the left and right y-axis. You can configure the following settings, for each chart type:

Note

After you change the chart type, rerun your code to update the chart. Rerunning executes the code again, so the results might change if your code is non-deterministic, for example if it uses random values.

Display

The Display settings vary based on the chart type selected. The following screenshot shows the Display settings for a Bubble chart.

Display menu of custom chart settings.

The following table describes the Display settings and indicates the chart types they apply to.

Setting Description Bubble Bar Line
Radius Data Choose between a data source variable or Fixed Size bubbles. y
Radius Scaling Set bubble size. y
Color Set the color of the bubble, bar, or line. y y y
Opacity Set the opacity of the bubble, bar, or line in the range 0 (transparent) to 100 (opaque). y y y
Fill Enable to fill the area of the line to the origin of the x-axis. y
Scale on Zoom Enable this option for bubbles to scale on zoom. When set the bubble size increases in size on zoom in and decreases on zoom out. y
Bar Percentage Toggle between Percentage or Fixed Width for bar width. y

Color Palette

Use the Color Palette settings to set the color for data points on the chart. Click on a color to change it or enter a Hex color value.

Color palette .

Chart Settings

The Chart Settings define crosshair and overlay behaviors.

Display overlay menu settings.

These settings are described in the following table.

Setting Description Default
Show Crosshairs When enabled, this adds a crosshair to the chart. Enabled
Show Coordinates When enabled, this displays axis values for cursor position in chart. Enabled
Snap Crosshair to Data When enabled, the Crosshair position locks to the y-axis value relative to x-axis position. Enabled
Show all data points When enabled, the Crosshair displays all values in a tooltip at the x-axis position. Disabled
Group tooltip by layer When enabled, the display of chart values is grouped in the tooltip by data layers. Disabled

Next steps

Back to top