Skip to content

Commit

Permalink
Add PlotLineXY.SetPlotYAxis
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenDang committed Sep 27, 2021
1 parent 36465fb commit cc935f2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Plot.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ type PlotLineXYWidget struct {
title string
xs, ys []float64
offset int
yAxis ImPlotYAxis
}

// PlotLineXY adds XY plot line to canvas
Expand All @@ -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
Expand All @@ -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)
}

Expand Down

0 comments on commit cc935f2

Please sign in to comment.