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

Setting up a precision on labels/chart. #267

Open
zthreee opened this issue Jan 16, 2023 · 1 comment
Open

Setting up a precision on labels/chart. #267

zthreee opened this issue Jan 16, 2023 · 1 comment

Comments

@zthreee
Copy link

zthreee commented Jan 16, 2023

Is there any way to set a precision for a chart?

I am charting different stock/crypto things and sometimes there is price that has 3-4 digits after comma (0.0463) for example, but when I do:

var markLineOpts []opts.MarkLineNameYAxisItem

for _, level := range closestLevels {
       markLineOpts = append(markLineOpts,
       opts.MarkLineNameYAxisItem{
					Name:  "S/R ",
					YAxis: level,
				})
}
charts.WithMarkLineNameYAxisItemOpts(markLineOpts...),
		charts.WithMarkLineStyleOpts(
			opts.MarkLineStyle{
				Symbol: []string{"none", "none"},
				Label: &opts.Label{
					Show:      true,
					Position:  "end",
					Color:     "black",
					Formatter: "{value}",
				},
			},
)

The price I see is not 0.0463, but actually it is rounds it up to 0.05.

This is the chart I am generating: https://imgur.com/QwVMluV
And the lines should have values: [0.132 0.1575 0.1469 0.1694 0.1206]

@Koooooo-7
Copy link
Member

Hi @zthreee , could u plz provide a sample here for reproduce it?

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

No branches or pull requests

2 participants