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

Number as string #9930

username1565 opened this issue Jan 18, 2019 · 4 comments


Copy link

commented Jan 18, 2019

Expected behaviour

String value on the chart.

Actual behaviour

String value sent to, expected Number
This happens if you pass in a string as a data point, for example in a setup like this:

series: [{
  data: ["3", "5", "1", "6"]

Live demo with steps to reproduce
line 39.

v[i] = [x[i], y[i]];


v[i] = [x[i], (y[i]).toFixed(8)];

Product version

Affected browser(s)

All browsers

I try to display bitcoin satoshies on the charts.
This have values, like 0.00000001,
but on the chars I can see 1e-8, if there is numbers in array.
I want to tell "0.00000001" as string, to convert this string to number,
make point at 0.00000001, and display the string "0.00000001", not the number "1e-8".
Is this possible? I just get the error with code 14.

You can see this trouble here:
PV = 0.00000010
Rate = 10%
Years = 50
and press "Plot"-button

I see here:
at line 13034, the following string:

pointFormat: '<span style="color:{point.color}">\u25CF</span> {}: <b>{point.y}</b><br/>',

Maybe need to add something, like this

	(0.00000001)			/*1e-8, float number*/,
	(0.00000001).toFixed(8)		/*"0.00000001" string output, not number*/

Best regards.


This comment has been minimized.

Copy link

commented Jan 18, 2019

I did fix this myself:

  1. Line 13034:
//pointFormat: '<span style="color:{point.color}">\u25CF</span> {}: <b>{point.y}</b><br/>',
pointFormat: '<span style="color:{point.color}">\u25CF</span> {}: <b>{point.y_text}</b><br/>',
  1. Line 29699:
var point = this,
series = this.series,
seriesOptions = series.options;
point.y_text = (point.y).toFixed(8);//number as text with fixed precission
  1. Line 39876
//pointFormat: 'x: <b>{point.x}</b><br/>y: <b>{point.y}</b><br/>'
pointFormat: 'x: <b>{point.x}</b><br/>y: <b>{point.y_text}</b><br/>'

That's all.
You can add the precission value, as parameter to chart.series.precission object.

But if I will enter here:
PV = 0.00000001 (1 satoshi)
Rate = 10%
Years = 50
and press "Plot"-button
I can see not full numbers on y-axis.
How to fix this and where - I don't know...

Also, I see one more attention in console:
event.returnValue is deprecated. Please use the standard event.preventDefault() instead. highcharts.src.js:24339
So you can fix this at line 24339, using the following code:

//e.returnValue = false; // #2251, #3224

if (!e.preventDefault) {
	e.preventDefault = function() {
		e.returnValue = false; //ie, Chrome, #2251, #3224, #9930

Have a nice day.


This comment has been minimized.

Copy link

commented Jan 18, 2019


I'd prefer using formatters so that you can keep the correct data:


This comment has been minimized.

Copy link

commented Jan 18, 2019

Good, it works with this

    series: [{
        data: [1e-7, 3e-7, 2e-7, 4e-7],
        type: 'column'


But... Also, fix the event.preventDefault() warning too.
I did write the code to fix this, in previous post.

Pic related (Google Chrome):


This comment has been minimized.

Copy link

commented Jan 21, 2019

Thanks! I don't see the warning myself, but I added a condition as it seems this returnValue is only needed in IE8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.