/visualize/image/chart

URL: http://<db.host>:<db.port>/visualize/image/chart

Scatter plot is the only plot type currently supported. A non-numeric column can be specified as x or y column and jitters can be added to them to avoid excessive overlapping. All color values must be in the format RRGGBB or AARRGGBB (to specify the alpha value). The image is contained in the output parameter image_data field.

Input Parameter Description

NameTypeDescription
table_namestringName of the table containing the data to be drawn as a chart, in [schema_name.]table_name format, using standard name resolution rules.
x_column_namesarray of stringsNames of the columns containing the data mapped to the x axis of a chart.
y_column_namesarray of stringsNames of the columns containing the data mapped to the y axis of a chart.
min_xdoubleLower bound for the x column values. For non-numeric x column, each x column item is mapped to an integral value starting from 0.
max_xdoubleUpper bound for the x column values. For non-numeric x column, each x column item is mapped to an integral value starting from 0.
min_ydoubleLower bound for the y column values. For non-numeric y column, each y column item is mapped to an integral value starting from 0.
max_ydoubleUpper bound for the y column values. For non-numeric y column, each y column item is mapped to an integral value starting from 0.
widthintWidth of the generated image in pixels.
heightintHeight of the generated image in pixels.
bg_colorstringBackground color of the generated image.
style_optionsmap of string to arrays of strings

Rendering style options for a chart.

Supported Parameters (keys)Parameter Description
pointcolorThe color of points in the plot represented as a hexadecimal number. The default value is '0000FF'.
pointsizeThe size of points in the plot represented as number of pixels. The default value is '3'.The minimum allowed value is 0. The maximum allowed value is 20.
pointshape

The shape of points in the plot. The default value is square. The supported values are:

  • none
  • circle
  • square
  • diamond
  • hollowcircle
  • hollowsquare
  • hollowdiamond
cb_pointcolorsPoint color class break information consisting of three entries: class-break attribute, class-break values/ranges, and point color values. This option overrides the pointcolor option if both are provided. Class-break ranges are represented in the form of "min:max". Class-break values/ranges and point color values are separated by cb_delimiter, e.g. {"price", "20:30;30:40;40:50", "0xFF0000;0x00FF00;0x0000FF"}.
cb_pointsizesPoint size class break information consisting of three entries: class-break attribute, class-break values/ranges, and point size values. This option overrides the pointsize option if both are provided. Class-break ranges are represented in the form of "min:max". Class-break values/ranges and point size values are separated by cb_delimiter, e.g. {"states", "NY;TX;CA", "3;5;7"}.
cb_pointshapesPoint shape class break information consisting of three entries: class-break attribute, class-break values/ranges, and point shape names. This option overrides the pointshape option if both are provided. Class-break ranges are represented in the form of "min:max". Class-break values/ranges and point shape names are separated by cb_delimiter, e.g. {"states", "NY;TX;CA", "circle;square;diamond"}.
cb_delimiterA character or string which separates per-class values in a class-break style option string. The default value is ';'.
x_order_byAn expression or aggregate expression by which non-numeric x column values are sorted, e.g. "avg(price) descending".
y_order_byAn expression or aggregate expression by which non-numeric y column values are sorted, e.g. "avg(price)", which defaults to "avg(price) ascending".
scale_type_x

Type of x axis scale. The default value is none.

Supported List EntriesDescription
noneNo scale is applied to the x axis.
logA base-10 log scale is applied to the x axis.
scale_type_y

Type of y axis scale. The default value is none.

Supported List EntriesDescription
noneNo scale is applied to the y axis.
logA base-10 log scale is applied to the y axis.
min_max_scaledIf this options is set to "false", this endpoint expects request's min/max values are not yet scaled. They will be scaled according to scale_type_x or scale_type_y for response. If this options is set to "true", this endpoint expects request's min/max values are already scaled according to scale_type_x/scale_type_y. Response's min/max values will be equal to request's min/max values. The default value is 'false'.
jitter_xAmplitude of horizontal jitter applied to non-numeric x column values. The default value is '0.0'.The minimum allowed value is 0.0. The maximum allowed value is 1.0.
jitter_yAmplitude of vertical jitter applied to non-numeric y column values. The default value is '0.0'.The minimum allowed value is 0.0. The maximum allowed value is 1.0.
plot_allIf this options is set to "true", all non-numeric column values are plotted ignoring min_x, max_x, min_y and max_y parameters. The default value is 'false'.
optionsmap of string to strings

Optional parameters. The default value is an empty map ( {} ).

Supported Parameters (keys)Parameter Description
image_encoding

Encoding to be applied to the output image. When using JSON serialization it is recommended to specify this as base64. The default value is none.

Supported ValuesDescription
base64Apply base64 encoding to the output image.
noneDo not apply any additional encoding to the output image.

Output Parameter Description

The GPUdb server embeds the endpoint response inside a standard response structure which contains status information and the actual response to the query. Here is a description of the various fields of the wrapper:

NameTypeDescription
statusString'OK' or 'ERROR'
messageStringEmpty if success or an error message
data_typeString'visualize_image_chart_response' or 'none' in case of an error
dataStringEmpty string
data_strJSON or String

This embedded JSON represents the result of the /visualize/image/chart endpoint:

NameTypeDescription
min_xdoubleLower bound for the x column values as provided in input parameter min_x or calculated for non-numeric columns when plot_all option is used.
max_xdoubleUpper bound for the x column values as provided in input parameter max_x or calculated for non-numeric columns when plot_all option is used.
min_ydoubleLower bound for the y column values as provided in input parameter min_y or calculated for non-numeric columns when plot_all option is used.
max_ydoubleUpper bound for the y column values as provided in input parameter max_y or calculated for non-numeric columns when plot_all option is used.
widthintWidth of the image as provided in input parameter width.
heightintHeight of the image as provided in input parameter height.
bg_colorstringBackground color of the image as provided in input parameter bg_color.
image_databytesThe generated image data.
axes_infomap of string to arrays of strings

Information returned for drawing labels for the axes associated with non-numeric columns.

Possible Parameters (keys)Parameter Description
sorted_x_valuesSorted non-numeric x column value list for drawing x axis label.
location_xX axis label positions of sorted_x_values in pixel coordinates.
sorted_y_valuesSorted non-numeric y column value list for drawing y axis label.
location_yY axis label positions of sorted_y_values in pixel coordinates.
infomap of string to stringsAdditional information.

Empty string in case of an error.