Chart3DComponent
public class Chart3DComponent : ChartComponent, IChartHostWorld-space host that turns a 3D Chart into actual rendered geometry: a surface mesh, a line mesh
for axes and grid, camera-facing labels and UnityEngine.Graphics.DrawMeshInstanced(UnityEngine.Mesh, int, UnityEngine.Material, UnityEngine.Matrix4x4[], int, UnityEngine.MaterialPropertyBlock, UnityEngine.Rendering.ShadowCastingMode, bool, int, UnityEngine.Camera, UnityEngine.Rendering.LightProbeUsage, UnityEngine.LightProbeProxyVolume) point symbols, all under a
hidden content child. Without a camera rig the content turns about the plot center to show the chart's pose, so
any camera sees the pose; a Chart3DCameraRig orbits by the pose instead.
Remarks
Section titled “Remarks”A ChartRaycaster on the camera brings it pointer events: hover tooltips, tap selection of marks and
of X, Y and Z values, drag to orbit and scroll or pinch to zoom.
Methods
Section titled “Methods”
PlayLift(float, Animation?, Action)
Section titled “PlayLift(float, Animation?, Action)”public void PlayLift(float lift, Animation? animation = null, Action completed = null)Animates Chart3DComponent.Lift to lift: toward 1 the flat chart lifts into 3D, toward 0 it flattens
into its 2D drawing. The marks move from where they are drawn through a keyed transition, as data changes do,
and the pose turns between the front view and the chart’s pose. animation defaults to the
chart’s animation; without one, or while the host is inactive, the lift shows at once.
completed runs when the lift ends, or at once without an animation.
Parameters
| Name | Type |
|---|---|
lift | System.Single |
animation | System.Nullable{ChartGuru.Animation} |
completed | System.Action |
RebuildMeshes()
Section titled “RebuildMeshes()”public void RebuildMeshes()Ends a running transition and rebuilds the chart’s geometry and axis chrome now, instead of on the next update.
Capture(Chart3DCaptureOptions)
Section titled “Capture(Chart3DCaptureOptions)”public Texture2D Capture(Chart3DCaptureOptions options)Renders what this host shows into a new image: its chart, compiled from the definition or set from code, with its plot size, data proportions, materials, axes, shadow plane, pose, projection and theme, framed like a camera orbiting by the pose. The scene is not involved: the chart renders on a private layer, without post-processing, so a transparent background keeps its alpha. A running transition is captured at its end.
Parameters
| Name | Type | Description |
|---|---|---|
options | ChartGuru.Chart3DCaptureOptions | Size, supersampling and background. Unset sizes use Chart3DCaptureOptions.Default. |
Returns
UnityEngine.Texture2D: An sRGB RGBA32 texture the caller owns and destroys, or null when the host shows no chart.
CaptureToPng(Chart3DCaptureOptions)
Section titled “CaptureToPng(Chart3DCaptureOptions)”public byte[] CaptureToPng(Chart3DCaptureOptions options)Renders what this host shows as with Chart3DComponent.Capture(Chart3DCaptureOptions) and encodes it as PNG, keeping a transparent
background’s alpha. Returns null when the host shows no chart.
Parameters
| Name | Type |
|---|---|
options | ChartGuru.Chart3DCaptureOptions |
Returns
System.Byte[]
Constructors
Section titled “Constructors”
Chart3DComponent()
Section titled “Chart3DComponent()”public Chart3DComponent()A new 3D chart starts as a 3D bar chart wherever it is created, including AddComponent in a player, where
ChartGuru.Chart3DComponent.Reset never runs. Unity constructs a component before it deserializes one, so a saved definition,
2D chart types included, replaces this default.
Properties
Section titled “Properties”
public float Lift { get; set; }How lifted the chart is drawn: 1, the default, draws it at full depth and its pose; 0 draws it flat and facing the
viewer from the front pose, as its 2D chart. Setting it shows the new lift at once; Chart3DComponent.PlayLift(float, Animation?, Action)
animates it. Definitions of 2D chart types always draw flat.
Returns
System.Single
IsLifting
Section titled “IsLifting”public bool IsLifting { get; }True while Chart3DComponent.PlayLift(float, Animation?, Action) animates the lift.
Returns
System.Boolean
PlotSize
Section titled “PlotSize”public Vector3 PlotSize { get; set; }Returns
UnityEngine.Vector3
PreserveDataProportions
Section titled “PreserveDataProportions”public bool PreserveDataProportions { get; set; }Returns
System.Boolean
SurfaceMaterialOverride
Section titled “SurfaceMaterialOverride”public Material SurfaceMaterialOverride { get; set; }Optional material for this chart’s surfaces, bars and points. When set it wins over the chart’s surface preset
(ChartSpatialSettings.SurfacePreset) and the theme’s material.
Returns
UnityEngine.Material
EffectiveSurfaceMaterial
Section titled “EffectiveSurfaceMaterial”public Material EffectiveSurfaceMaterial { get; }Resolved surface material: Chart3DComponent.SurfaceMaterialOverride, else the chart’s surface preset when it is not
Chart3DSurfacePreset.Theme, else the theme’s material, else the built-in theme preset.
Returns
UnityEngine.Material
DrawAxes
Section titled “DrawAxes”public bool DrawAxes { get; set; }Returns
System.Boolean
DrawShadowPlane
Section titled “DrawShadowPlane”public bool DrawShadowPlane { get; set; }Returns
System.Boolean
DrawEnvironment
Section titled “DrawEnvironment”public bool DrawEnvironment { get; set; }Returns
System.Boolean
CameraRig
Section titled “CameraRig”public Chart3DCameraRig CameraRig { get; }Returns
ChartGuru.Chart3DCameraRig
LocalPlotBounds
Section titled “LocalPlotBounds”public Bounds LocalPlotBounds { get; }Returns
UnityEngine.Bounds
ResolvedPlotBounds
Section titled “ResolvedPlotBounds”public Bounds ResolvedPlotBounds { get; }Plot-space envelope after applying explicit axis ranges.
Returns
UnityEngine.Bounds