From cc935f247537eb879a56db9d1dbecf4e9224fb64 Mon Sep 17 00:00:00 2001 From: AllenDang Date: Mon, 27 Sep 2021 15:52:00 +0800 Subject: [PATCH] Add PlotLineXY.SetPlotYAxis --- Plot.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Plot.go b/Plot.go index 4b86432d..56125f47 100644 --- a/Plot.go +++ b/Plot.go @@ -331,6 +331,7 @@ type PlotLineXYWidget struct { title string xs, ys []float64 offset int + yAxis ImPlotYAxis } // PlotLineXY adds XY plot line to canvas @@ -343,6 +344,12 @@ func PlotLineXY(title string, xvalues, yvalues []float64) *PlotLineXYWidget { } } +// SetPlotYAxis sets yAxis parameters +func (p *PlotLineXYWidget) SetPlotYAxis(yAxis ImPlotYAxis) *PlotLineXYWidget { + p.yAxis = yAxis + return p +} + // Offset sets chart's offset func (p *PlotLineXYWidget) Offset(offset int) *PlotLineXYWidget { p.offset = offset @@ -351,6 +358,7 @@ func (p *PlotLineXYWidget) Offset(offset int) *PlotLineXYWidget { // Plot implements Plot interface func (p *PlotLineXYWidget) Plot() { + imgui.ImPlotSetPlotYAxis(imgui.ImPlotYAxis(p.yAxis)) imgui.ImPlotLineXY(tStr(p.title), p.xs, p.ys, p.offset) }