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

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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

@@ -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")

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)

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) {
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