Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plot: 2nd and 3rd axis support #765

Open
gucio321 opened this issue Feb 20, 2024 · 4 comments
Open

Plot: 2nd and 3rd axis support #765

gucio321 opened this issue Feb 20, 2024 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@gucio321
Copy link
Collaborator

          @gucio321 

"2nd and 3rd axis":

old code was:

giu.Plot("Rotation").Flags(giu.PlotFlagsYAxis2).Plots( .... )

now it doesn't work because PlotFlagsYAxis2 doesn't exist, in flags.go it is commented out:

const (
	PlotFlagsNone        = PlotFlags(imgui.PlotFlagsNone)
	PlotFlagsNoTitle     = PlotFlags(imgui.PlotFlagsNoTitle)
	PlotFlagsNoLegend    = PlotFlags(imgui.PlotFlagsNoLegend)
	PlotFlagsNoMenus     = PlotFlags(imgui.PlotFlagsNoMenus)
	PlotFlagsNoBoxSelect = PlotFlags(imgui.PlotFlagsNoBoxSelect)
	// 	PlotFlagsNoMousePos  = PlotFlags(imgui.PlotFlagsNoMousePos)
	// 	PlotFlagsNoHighlight = PlotFlags(imgui.PlotFlagsNoHighlight)
	// PlotFlagsNoChild = PlotFlags(imgui.PlotFlagsNoChild).
	PlotFlagsEqual = PlotFlags(imgui.PlotFlagsEqual)
	// 	PlotFlagsYAxis2      = PlotFlags(imgui.PlotFlagsYAxis2)
	// 	PlotFlagsYAxis3      = PlotFlags(imgui.PlotFlagsYAxis3)
	// 	PlotFlagsQuery       = PlotFlags(imgui.PlotFlagsQuery)
	PlotFlagsCrosshairs = PlotFlags(imgui.PlotFlagsCrosshairs)
	// 	PlotFlagsAntiAliased = PlotFlags(imgui.PlotFlagsAntiAliased)
	PlotFlagsCanvasOnly = PlotFlags(imgui.PlotFlagsCanvasOnly)
)

I have no idea how to activate second/third axis

Originally posted by @francmarx in #632 (comment)

@runrc
Copy link

runrc commented Jun 21, 2024

Is this likely to be addressed anytime soon? It would be really useful to plot using multiple axis.

@gucio321
Copy link
Collaborator Author

ok, let me take a look

@gucio321
Copy link
Collaborator Author

cimgui-go ref:

// original name: ImAxis_
type PlotAxisEnum int32

const (
        AxisX1    PlotAxisEnum = 0
        AxisX2    PlotAxisEnum = 1
        AxisX3    PlotAxisEnum = 2
        AxisY1    PlotAxisEnum = 3
        AxisY2    PlotAxisEnum = 4
        AxisY3    PlotAxisEnum = 5
        AxisCOUNT PlotAxisEnum = 6
)

(cimplot_enums.go)

func PlotSetAxes(x_axis PlotAxisEnum, y_axis PlotAxisEnum) {
        C.ImPlot_SetAxes(C.ImAxis(x_axis), C.ImAxis(y_axis))
}

(cimplot_funcs.go)

// Select which axis/axes will be used for subsequent plot elements.
IMPLOT_API void SetAxis(ImAxis axis);
IMPLOT_API void SetAxes(ImAxis x_axis, ImAxis y_axis);

@gucio321
Copy link
Collaborator Author

ok @runrc I opened #805

As I said, I don't have much free time at the moment as I'm in the middle of my examination session 😄, but I added some stuff that involves cimgui-go experience. What needs to be done now is improving giu api.
Feel free to finish my work and open PR ;-)

@gucio321 gucio321 added enhancement New feature or request good first issue Good for newcomers labels Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants