Documentation
¶
Overview ¶
Package charts3d provides Go bindings for the 3D portion of Apple's Charts framework.
The package is separate from github.com/tmc/swiftui/charts so the 2D API stays focused. It currently covers practical 3D chart construction: point, rule, and rectangle marks; surface plots; domains and scale types; axis labels; and camera pose and projection controls.
The package requires the macOS 26 Charts APIs.
Quick start ¶
import (
"github.com/tmc/swiftui/charts3d"
)
view := charts3d.Chart3D(
charts3d.PointMark(
charts3d.XFloat("Step", 1),
charts3d.YFloat("Loss", 0.42),
charts3d.ZFloat("Depth", 3),
),
).View()
_ = view
Index ¶
- Variables
- type AnnotationPosition
- type AxisLabelOption
- type CameraProjection
- type Chart3DPose
- type Chart3DView
- func (c Chart3DView) AsView() swiftui.View
- func (c Chart3DView) Chart3DCameraProjection(projection CameraProjection) Chart3DView
- func (c Chart3DView) Chart3DPose(pose Chart3DPose) Chart3DView
- func (c Chart3DView) ChartXAxisLabel(text string, opts ...AxisLabelOption) Chart3DView
- func (c Chart3DView) ChartXScaleDomain(domain Domain) Chart3DView
- func (c Chart3DView) ChartXScaleType(scaleType ScaleType) Chart3DView
- func (c Chart3DView) ChartYAxisLabel(text string, opts ...AxisLabelOption) Chart3DView
- func (c Chart3DView) ChartYScaleDomain(domain Domain) Chart3DView
- func (c Chart3DView) ChartYScaleType(scaleType ScaleType) Chart3DView
- func (c Chart3DView) ChartZAxisLabel(text string, opts ...AxisLabelOption) Chart3DView
- func (c Chart3DView) ChartZScaleDomain(domain Domain) Chart3DView
- func (c Chart3DView) ChartZScaleType(scaleType ScaleType) Chart3DView
- func (c Chart3DView) Frame(width, height float64) swiftui.View
- func (c Chart3DView) Pointer() uintptr
- func (c Chart3DView) Surface(surface SurfacePlotContent) Chart3DView
- func (c Chart3DView) View() swiftui.View
- type Dim
- func X(v Value) Dim
- func XDate(label string, value time.Time, unit TimeUnit) Dim
- func XFloat(label string, value float64) Dim
- func XInt(label string, value int) Dim
- func Y(v Value) Dim
- func YFloat(label string, value float64) Dim
- func YInt(label string, value int) Dim
- func Z(v Value) Dim
- func ZFloat(label string, value float64) Dim
- func ZInt(label string, value int) Dim
- type Domain
- type LabelAlignment
- type Mark
- type ScaleType
- type SurfacePlotContent
- type TimeUnit
- type Value
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ( Chart3DPoseDefault = Chart3DPose{/* contains filtered or unexported fields */} Chart3DPoseFront = Chart3DPose{/* contains filtered or unexported fields */} Chart3DPoseBack = Chart3DPose{/* contains filtered or unexported fields */} Chart3DPoseTop = Chart3DPose{/* contains filtered or unexported fields */} Chart3DPoseBottom = Chart3DPose{/* contains filtered or unexported fields */} Chart3DPoseLeft = Chart3DPose{/* contains filtered or unexported fields */} Chart3DPoseRight = Chart3DPose{/* contains filtered or unexported fields */} )
var ( ScaleTypeAutomatic = ScaleType{/* contains filtered or unexported fields */} ScaleTypeLinear = ScaleType{/* contains filtered or unexported fields */} ScaleTypeLog = ScaleType{/* contains filtered or unexported fields */} ScaleTypeDate = ScaleType{/* contains filtered or unexported fields */} ScaleTypeSquareRoot = ScaleType{/* contains filtered or unexported fields */} )
Functions ¶
This section is empty.
Types ¶
type AnnotationPosition ¶
type AnnotationPosition int32
const ( AnnotationTop AnnotationPosition = iota AnnotationBottom AnnotationLeading AnnotationTrailing AnnotationOverlay AnnotationTopLeading AnnotationTopTrailing AnnotationBottomLeading AnnotationBottomTrailing AnnotationAutomatic )
type AxisLabelOption ¶
type AxisLabelOption struct {
// contains filtered or unexported fields
}
func AxisLabelAlignment ¶
func AxisLabelAlignment(alignment LabelAlignment) AxisLabelOption
func AxisLabelPosition ¶
func AxisLabelPosition(position AnnotationPosition) AxisLabelOption
func AxisLabelSpacing ¶
func AxisLabelSpacing(spacing float64) AxisLabelOption
type CameraProjection ¶
type CameraProjection int32
CameraProjection controls the chart camera projection.
const ( CameraProjectionAutomatic CameraProjection = iota CameraProjectionOrthographic CameraProjectionPerspective )
type Chart3DPose ¶
type Chart3DPose struct {
// contains filtered or unexported fields
}
Chart3DPose controls the viewpoint of a 3D chart.
func CustomChart3DPose ¶
func CustomChart3DPose(azimuthDegrees, inclinationDegrees float64) Chart3DPose
type Chart3DView ¶
type Chart3DView struct {
// contains filtered or unexported fields
}
Chart3DView is a lazily-built 3D chart view.
func Chart3D ¶
func Chart3D(marks ...Mark) Chart3DView
Chart3D creates a 3D chart from z-aware marks.
Example ¶
package main
import (
"github.com/tmc/swiftui/charts3d"
)
func main() {
view := charts3d.Chart3D(
charts3d.PointMark(
charts3d.XFloat("Step", 1),
charts3d.YFloat("Loss", 0.42),
charts3d.ZFloat("Depth", 3),
),
).ChartZAxisLabel("Depth").View()
_ = view
}
func (Chart3DView) AsView ¶
func (c Chart3DView) AsView() swiftui.View
func (Chart3DView) Chart3DCameraProjection ¶
func (c Chart3DView) Chart3DCameraProjection(projection CameraProjection) Chart3DView
func (Chart3DView) Chart3DPose ¶
func (c Chart3DView) Chart3DPose(pose Chart3DPose) Chart3DView
func (Chart3DView) ChartXAxisLabel ¶
func (c Chart3DView) ChartXAxisLabel(text string, opts ...AxisLabelOption) Chart3DView
func (Chart3DView) ChartXScaleDomain ¶
func (c Chart3DView) ChartXScaleDomain(domain Domain) Chart3DView
func (Chart3DView) ChartXScaleType ¶
func (c Chart3DView) ChartXScaleType(scaleType ScaleType) Chart3DView
func (Chart3DView) ChartYAxisLabel ¶
func (c Chart3DView) ChartYAxisLabel(text string, opts ...AxisLabelOption) Chart3DView
func (Chart3DView) ChartYScaleDomain ¶
func (c Chart3DView) ChartYScaleDomain(domain Domain) Chart3DView
func (Chart3DView) ChartYScaleType ¶
func (c Chart3DView) ChartYScaleType(scaleType ScaleType) Chart3DView
func (Chart3DView) ChartZAxisLabel ¶
func (c Chart3DView) ChartZAxisLabel(text string, opts ...AxisLabelOption) Chart3DView
func (Chart3DView) ChartZScaleDomain ¶
func (c Chart3DView) ChartZScaleDomain(domain Domain) Chart3DView
func (Chart3DView) ChartZScaleType ¶
func (c Chart3DView) ChartZScaleType(scaleType ScaleType) Chart3DView
func (Chart3DView) Pointer ¶
func (c Chart3DView) Pointer() uintptr
func (Chart3DView) Surface ¶
func (c Chart3DView) Surface(surface SurfacePlotContent) Chart3DView
func (Chart3DView) View ¶
func (c Chart3DView) View() swiftui.View
type Domain ¶
type Domain struct {
// contains filtered or unexported fields
}
func IntegerDomain ¶
func NumberDomain ¶
func TimeDomain ¶
type LabelAlignment ¶
type LabelAlignment int32
const ( LabelAlignmentCenter LabelAlignment = iota LabelAlignmentLeading LabelAlignmentTrailing LabelAlignmentTop LabelAlignmentBottom LabelAlignmentTopLeading LabelAlignmentTopTrailing LabelAlignmentBottomLeading LabelAlignmentBottomTrailing )
type ScaleType ¶
type ScaleType struct {
// contains filtered or unexported fields
}
func ScaleTypePower ¶
func ScaleTypeSymmetricLog ¶
type SurfacePlotContent ¶
type SurfacePlotContent struct {
// contains filtered or unexported fields
}
SurfacePlotContent is a bridged Swift Charts surface plot.
func SurfacePlot ¶
func SurfacePlot(xLabel, yLabel, zLabel string, f func(x, z float64) float64) SurfacePlotContent
SurfacePlot creates a 3D surface plot from a Go callback.
type Value ¶
type Value struct {
// contains filtered or unexported fields
}