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

Closes #2103: Improve axis labels formatting #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions src/teechart.js
Original file line number Diff line number Diff line change
Expand Up @@ -2526,6 +2526,23 @@ function Axis(chart,horizontal,otherSide) {

this.maxLabelDepth = 0;

function NumberFormatOptions() {
this.localeMatcher;
this.style;
this.currency;
this.currencyDisplay;
this.useGrouping;
this.minimumIntegerDigits;
this.minimumFractionDigits;
this.maximumFractionDigits;
this.minimumSignificantDigits;
this.maximumSignificantDigits;
}

function FormatValueOptions() {
this.locales;
this.options = new NumberFormatOptions();
};
/**
* @constructor
* @public
Expand Down Expand Up @@ -2593,10 +2610,14 @@ function Axis(chart,horizontal,otherSide) {
this._text=s;
}


this.formatValueString=function(value)
{
if (this.valueFormat){
this.valueFormat = new FormatValueOptions();

this.formatValueString=function(value) {
if (this.valueFormat) {
if ((this.valueFormat.locales) || (this.valueFormat.options)) {
return value.toLocaleString(this.valueFormat.locales, this.valueFormat.options);
}

var DecimalSeparator = Number("1.2").toLocaleString().substr(1,1);

var AmountWithCommas = (value * 1).toLocaleString();
Expand All @@ -2616,7 +2637,7 @@ function Axis(chart,horizontal,otherSide) {
return intPart + DecimalSeparator + decPart;
else
return intPart;
}
}
else
return value.toFixed(this.decimals);
}
Expand Down