Skip to content

Commit

Permalink
add SwitchPlotAxes function
Browse files Browse the repository at this point in the history
  • Loading branch information
gucio321 committed Jun 25, 2024
1 parent c7c4a64 commit 608bb80
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion Plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,26 @@ func (p *PlotCanvasWidget) Build() {
}
}

type (
PlotXAxis = imgui.PlotAxisEnum
PlotYAxis = imgui.PlotAxisEnum
)

const (
AxisX1 = PlotXAxis(imgui.AxisX1)
AxisX2 = PlotXAxis(imgui.AxisX2)
AxisX3 = PlotXAxis(imgui.AxisX3)
AxisY1 = PlotYAxis(imgui.AxisY1)
AxisY2 = PlotYAxis(imgui.AxisY2)
AxisY3 = PlotYAxis(imgui.AxisY3)
)

func SwitchPlotAxes(x PlotXAxis, y PlotYAxis) PlotWidget {
return Custom(func() {
imgui.PlotSetAxes(imgui.PlotAxisEnum(x), imgui.PlotAxisEnum(y))
})
}

// BarPlot adds bar plot (column chart) to the canvas.
type BarPlot struct {
title string
Expand All @@ -251,7 +271,6 @@ type BarPlot struct {
offset int
}

// Bar adds a plot bar (column chart).
func Bar(title string, data []float64) *BarPlot {
return &BarPlot{
title: title,
Expand Down

0 comments on commit 608bb80

Please sign in to comment.