Skip to content

Updated plot to make use of data minimum for setting up plot Y axis#241

Open
sivamgr wants to merge 1 commit intogizak:masterfrom
sivamgr:master
Open

Updated plot to make use of data minimum for setting up plot Y axis#241
sivamgr wants to merge 1 commit intogizak:masterfrom
sivamgr:master

Conversation

@sivamgr
Copy link

@sivamgr sivamgr commented Jul 28, 2019

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


func GetMinFloat64From2dSlice(slices [][]float64) (float64, error) {
if len(slices) == 0 {
return 0, fmt.Errorf("cannot get max value from empty slice")

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

minVal := self.MinVal
if maxVal == 0 {
maxVal, _ = GetMaxFloat64From2dSlice(self.Data)
minVal, _ = GetMinFloat64From2dSlice(self.Data)

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?

}

func (self *Plot) renderBraille(buf *Buffer, drawArea image.Rectangle, maxVal float64) {
func (self *Plot) renderBraille(buf *Buffer, drawArea image.Rectangle, minVal float64, maxVal float64) {
Copy link

@iamquang95 iamquang95 Feb 21, 2020

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

@iamquang95
Copy link

I did an update version of this pr here: #259

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants