Skip to main content
v2.2

3D Boxes

Chart3D has Box Series for visualization of large sets of individually configurable 3D Boxes.

Box SeriesBox Series

Creating 3D Box​

series = chart.add_box_series()

Adding Box Data​

Append or update your box-series data by providing an array of centered box definitions. Each object must include:

  • xCenter, yCenter, zCenter: coordinates of the box center
  • xSize, ySize, zSize: sizes of the box along each axis
# Supply a single box
series.add({
'xCenter': 0, 'yCenter': 0, 'zCenter': 0,
'xSize': 1, 'ySize': 2, 'zSize': 1,
})

# Or multiple boxes at once
series.add([
{'xCenter': 2, 'yCenter': 0, 'zCenter': -1, 'xSize': 1, 'ySize': 1, 'zSize': 1},
{'xCenter': -2, 'yCenter': 1, 'zCenter': 1, 'xSize': 0.5, 'ySize': 2, 'zSize': 0.5},
])

Model Coloring​

Solid Fill Style​

Use a single static color for all boxes:

series.set_color('#ff0000')

Palette Coloring​

Alternative approach to single static color, you can give each box a number value, and specify rules for getting a color from any number:

# Define a color lookup table
series.set_palette_coloring(
steps=[
{'value': 0.0, 'color': '#00ff00', 'label': 'Min'},
{'value': 5.0, 'color': '#ffff00'},
{'value': 10.0, 'color': '#0000ff', 'label': 'Max'},
],
look_up_property='value', # Instead of using lookup values in data set, you can also use X, Y or Z coordinates directly
interpolate=True,
)

# With formatted legend display:
series.set_palette_coloring(
steps=[
{'value': 0, 'color': '#0000FF'},
{'value': 100, 'color': '#FF0000'},
],
look_up_property='value',
formatter_precision=2, # Decimal places
formatter_unit='mag', # Unit suffix
formatter_scale=1.5, # Scale values
formatter_type='scientific', # 'standard', 'compact', 'engineering', 'scientific'
formatter_operation='floor', # 'none', 'round', 'ceil', 'floor'
)

Removing Color​

# Remove the fill color:
series.set_empty_color_fill()

Shading & Depth Testing​

These sections works the same as for 3D Line, to avoid duplication of guides, please refer to the section under line

# Disable depth testing so fully transparent
series.set_depth_test_enabled(False)

# Switch between flat shading and Phong (smooth) shading,
# and tune specular highlight strength & color
series.set_color_shading_style(
phong_shading=True,
specular_reflection=0.8,
specular_color='#ffffff'
)

Rounded Edges​

Enable or disable rounded corners on all boxes. A roundness between 0 - 1 controls curvature and None restores sharp edges.

# Smooth, half-rounded corners everywhere
series.set_rounded_edges(0.5)

# Disable rounding (sharp corners)
series.set_rounded_edges(None)

Series Utility Methods​

This section works the same as for Line, to avoid duplication of guides, please refer to the section under Line

Legend​

Please see common legend section.

Examples​

Link to the examples