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

Add IntTicks #360

Closed
wants to merge 1 commit into from
Closed

Add IntTicks #360

wants to merge 1 commit into from

Conversation

isa9660
Copy link

@isa9660 isa9660 commented May 16, 2017

Nice to meet you. Thank you for a wonderful library.
In order to easily represent integers, I created 'IntTicks'.
By the way, if you change 'DefaultTicks' in 'Custom tick marks' of example to 'IntTicks', it will have the same result as the example.
('1,.5e,+04'->'15,000','1e,+04'->'10,000)

@DavidGamba
Copy link

Take a look at #362.
With it, you should be able to do:

    type myCustomFormatTicks struct{}

    var _ plot.Ticker = myCustomFormatTicks{}

    func (myCustomFormatTicks) Ticks(min, max float64, format func(v float64, prec int) string) (ticks []plot.Tick) {
      return plot.DefaultTicks{}.Ticks(min, max, myFormatFloatTick)
    }

    func myFormatFloatTick(v float64, prec int) string {
           return strconv.FormatFloat(floats.Round(v, prec), 'f', 0, 64)
    }

    p.Y.Tick.Marker = myCustomFormatTicks{}

And get the same results.

@isa9660
Copy link
Author

isa9660 commented May 28, 2017

I had planned from before.
Even now I can do it custom, so I am not in trouble,
I will close it. Thank you very much!

@isa9660 isa9660 closed this May 28, 2017
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