-
Notifications
You must be signed in to change notification settings - Fork 787
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
Updated plot to make use of data minimum for setting up plot Y axis #241
base: master
Are you sure you want to change the base?
Conversation
@@ -108,6 +108,22 @@ func GetMaxFloat64From2dSlice(slices [][]float64) (float64, error) { | |||
return max, nil | |||
} | |||
|
|||
func GetMinFloat64From2dSlice(slices [][]float64) (float64, error) { | |||
if len(slices) == 0 { | |||
return 0, fmt.Errorf("cannot get max value from empty slice") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cannot get max value from empty slice
-> cannot get min value from empty slice
if maxVal == 0 { | ||
maxVal, _ = GetMaxFloat64From2dSlice(self.Data) | ||
minVal, _ = GetMinFloat64From2dSlice(self.Data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if maxVal == 0
, the minVal
will be re-calculated even user sets this value by purpose?
@@ -76,7 +77,7 @@ func NewPlot() *Plot { | |||
} | |||
} | |||
|
|||
func (self *Plot) renderBraille(buf *Buffer, drawArea image.Rectangle, maxVal float64) { | |||
func (self *Plot) renderBraille(buf *Buffer, drawArea image.Rectangle, minVal float64, maxVal float64) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You missed implementation of this part
I did an update version of this pr here: #259 |
Irrespective of data set range the Y axis always points to zero. Updated plots to make use of minimum value from data to set the Y axis start value