In some cases an administrator might want to override existing chart options for the charting library (Highcharts) that edgeCore is using. To do so, download the Highcharts adapter example here and edit the provided JavaScript file HighchartsOverrides.js and zip it up again and load it into edgeCore.
JavaScript
x
70
70
1
(function () {
2
'use strict';
3
/* These are the time units that Highcharts use for its default formatting
4
* Documentation for dateTimeLabelFormats (which use subset of the formats for PHP's strftime)
5
* https://api.highcharts.com/class-reference/Highcharts#.dateFormat
6
* http://www.php.net/manual/en/function.strftime.php
7
*
8
9
default Highcharts date format
10
{
11
millisecond: '%H:%M:%S.%L',
12
second: '%H:%M:%S',
13
minute: '%H:%M',
14
hour: '%H:%M',
15
day: '%e. %b',
16
week: '%e. %b',
17
month: '%b \'%y',
18
year: '%Y'
19
}
20
21
edgeSuite overrides the following - localized = false:
22
{
23
month: "%Y-%m",
24
week: "%Y-%m-%d",
25
day: "%Y-%m-%d"
26
}
27
28
localized = true:
29
{
30
month: "%\u03B1",
31
week: "%x",
32
day: "%x"
33
}
34
35
In addition, edgeSuite added 2 custom date replacement codes:
36
%x: format the date with moment js L setting.
37
%\u03B1: (which is Greek alpha character), same as 'x' except without the day field.
38
39
Moment JS documentation for Localized formats: L
40
https://momentjs.com/docs/#/displaying/format/
41
42
*/
43
/* override dateTimeLabelFormats with European date regardless what chart's setting or user's preference
44
* Note you can override any other chart options as specified in Highcharts Documentation
45
* https://api.highcharts.com/highcharts/ -> Highcharts.chart
46
*/
47
Highcharts.$$chartOptions = {
48
xAxis: {
49
dateTimeLabelFormats: {
50
month: "%m.%Y",
51
week: "%d.%m.%Y",
52
day: "%d.%m.%Y"
53
}
54
}
55
}
56
57
/* as for number, edgeSuite will set it according the user's locale and you can override that with the
58
* following lines uncommented. Always use European number separator
59
* Note you can override any other chart options as specified in Highcharts Documentation
60
* https://api.highcharts.com/highcharts/ -> Highcharts.lang
61
*/
62
/*
63
Highcharts.$$langOptions = {
64
lang: {
65
thousandsSep: " ",
66
decimalPoint: ","
67
}
68
}
69
*/
70
})();