Change axes months language
See original GitHub issueI’m submitting a … (check one with “x”)
- bug report - search github for a similar issue or PR before submitting
- feature request
- support request - use StackOverflow (add the
ngx-charts
tag) or the gitter chat for support questions
Current behavior
Hi, I’m working with ngx-charts, I get a JSON with a structure similar to this one:
[
{
"name": "Réunion",
"series": [
{
"value": 4500,
"name": "2016-09-17T09:08:09.631Z"
},
{
"value": 6193,
"name": "2016-09-19T15:58:09.930Z"
},
{
"value": 4003,
"name": "2016-09-19T07:59:57.198Z"
},
{
"value": 6137,
"name": "2016-09-17T16:12:09.567Z"
},
{
"value": 4178,
"name": "2016-09-13T12:24:55.620Z"
}
]
},
{
"name": "Réunion",
"series": [
{
"value": 4905,
"name": "2016-09-17T09:08:09.631Z"
},
{
"value": 4014,
"name": "2016-09-19T15:58:09.930Z"
},
{
"value": 6364,
"name": "2016-09-19T07:59:57.198Z"
},
{
"value": 5178,
"name": "2016-09-17T16:12:09.567Z"
},
{
"value": 5943,
"name": "2016-09-13T12:24:55.620Z"
}
]
},
{
"name": "Chile",
"series": [
{
"value": 5591,
"name": "2016-09-17T09:08:09.631Z"
},
{
"value": 3054,
"name": "2016-09-19T15:58:09.930Z"
},
{
"value": 3881,
"name": "2016-09-19T07:59:57.198Z"
},
{
"value": 3528,
"name": "2016-09-17T16:12:09.567Z"
},
{
"value": 2314,
"name": "2016-09-13T12:24:55.620Z"
}
]
},
{
"name": "Suriname",
"series": [
{
"value": 5628,
"name": "2016-09-17T09:08:09.631Z"
},
{
"value": 6187,
"name": "2016-09-19T15:58:09.930Z"
},
{
"value": 5970,
"name": "2016-09-19T07:59:57.198Z"
},
{
"value": 4305,
"name": "2016-09-17T16:12:09.567Z"
},
{
"value": 2944,
"name": "2016-09-13T12:24:55.620Z"
}
]
},
{
"name": "Senegal",
"series": [
{
"value": 3874,
"name": "2016-09-17T09:08:09.631Z"
},
{
"value": 6686,
"name": "2016-09-19T15:58:09.930Z"
},
{
"value": 4061,
"name": "2016-09-19T07:59:57.198Z"
},
{
"value": 6735,
"name": "2016-09-17T16:12:09.567Z"
},
{
"value": 4148,
"name": "2016-09-13T12:24:55.620Z"
}
]
}
]
to make the transformation I use the following code:
this.data = this.multi.map(group => {
group.series = group.series.map(dataItem => {
// dataItem.name = moment(dataItem.name).format('llll');
dataItem.name = new Date(dataItem.name);
return dataItem;
});
return group;
});
My problem is that the lower bar of the X axis appear in English and I would like to change the language. How could I do this without losing the timeline?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:5
Top Results From Across the Web
How to Change Line Chart X-asix Month Language
How to Change Line Chart X-asix Month Language · 1. Go to query-editor · 2. Select New Source and from there Blank Query...
Read more >How do I change the 'months' language displayed on the date ...
I am using Chart JS to plot data and on the date axis (x-axis) shows '20 Dec ...
Read more >Change language of shown months on the X-Axis
Hello Community,. in my datasource I have 2 fields, which are called as "Year" and "Calendar Month". Both fields are combined by integer ......
Read more >Change axis labels in a chart in Office - Microsoft Support
The chart uses text from your source data for axis labels. To change the label, you can change the text in the source...
Read more >8.17 Using Dates on an Axis | R Graphics Cookbook, 2nd edition
Months and days have different names in different languages (the examples here are generated with a US locale). You can change the locale...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can use ngx-translate to translate your x-axis ticks.
In your component.html:
In your component.ts:
Unfortunately the language is harcoded in
app.component.ts
in this line: