diff --git a/HISTORY.md b/HISTORY.md
index bb8cc623..57311976 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -9,6 +9,7 @@ http://visjs.org
- Fixed the `change` event sometimes being fired twice on IE10.
- Fixed canceling moving an item to another group did not move the item
back to the original group.
+- Added localization support.
### Network
@@ -21,7 +22,7 @@ http://visjs.org
- Added 'allowOverlap' option for barCharts.
- Added two examples showing the two additions above.
- Added 'customRange' for the Y axis and an example showing how it works.
-
+- Added localization support.
## 2014-08-14, version 3.2.0
diff --git a/docs/graph2d.html b/docs/graph2d.html
index f2657c65..f7c2bf24 100644
--- a/docs/graph2d.html
+++ b/docs/graph2d.html
@@ -48,6 +48,8 @@
@@ -91,7 +93,7 @@
start: '2014-06-10',
end: '2014-06-18'
};
- var graph2d = new vis.Graph2d(container, dataset, options);
+ var Graph2d = new vis.Graph2d(container, dataset, options);
</script>
</body>
</html>
@@ -278,13 +280,13 @@ groups.add({
slots.slot
Number
-
The slot the bar chart is plotted in. This has to be used in combination with slots.total. See example 11 for more information.
+
The slot the bar chart is plotted in. This has to be used in combination with slots.total. See example 11 for more information.
slots.total
Number
-
The total amount of slots available. This has to be used in combination with slots.slot. See example 11 for more information.
+
The total amount of slots available. This has to be used in combination with slots.slot. See example 11 for more information.
@@ -316,7 +318,7 @@ The options colored in green can also be used as options for the groups. All opt
yAxisOrientation
String
'left'
-
This defines with which axis, left or right, the graph is coupled. Example 5 shows groups with different Y axis. If no groups are coupled
+
This defines with which axis, left or right, the graph is coupled. Example 5 shows groups with different Y axis. If no groups are coupled
with an axis, it will not be shown.
@@ -336,7 +338,7 @@ The options colored in green can also be used as options for the groups. All opt
sampling
Boolean
true
-
If sampling is enabled, graph2D will automatically determine the amount of points per pixel.
+
If sampling is enabled, Graph2d will automatically determine the amount of points per pixel.
If there are more than 1 point per pixel, not all points will be drawn. Disabling sampling will cause a decrease in performance.
@@ -388,8 +390,8 @@ The options colored in green can also be used as options for the groups. All opt
Boolean
true
When true, bars that have the same x coordinate are plotted on top of eachother (not stacking).
- See example 10 for more information.
- When using groups, see example 11.
+ See example 10 for more information.
+ When using groups, see example 11.
@@ -408,7 +410,7 @@ The options colored in green can also be used as options for the groups. All opt
catmullRom.parametrization
String
'centripetal'
-
Define the type of parametrizaion. Example 7 shows the different methods. The options are 'centripetal' (best results), 'chordal' and 'uniform'. Uniform is the computationally cheapest variant.
+
Define the type of parametrizaion. Example 7 shows the different methods. The options are 'centripetal' (best results), 'chordal' and 'uniform'. Uniform is the computationally cheapest variant.
If catmullRom is disabled, linear interpolation is used.
@@ -512,7 +514,7 @@ The options colored in green can also be used as options for the groups. All opt
Timeline Options
- Graph2d is built upon the framework of the timeline. These options from the timeline can be used with graph2D.
+ Graph2d is built upon the framework of the timeline. These options from the timeline can be used with Graph2d.
All options are optional.
+ Graph2d can be localized. For localization, Graph2d depends largely on the localization of moment.js. Locales are not included in vis.js by default. To enable localization, moment.js must be loaded with locales. Moment.js offers a bundle named "moment-with-locales.min.js" for this and there are various alternative ways to load locales.
+
+
+
+ To set a locale for the Graph2d, specify the option locale:
+
+
+
var options = {
+ locale: 'nl'
+};
+
+
+
Create a new locale
+
+To load a locale into the Graph2d not supported by default, one can add a new locale to the option locales:
+
+
var options = {
+ locales: {
+ // create a new locale
+ mylocale: {
+ current: 'current',
+ time: 'time',
+ }
+ },
+
+ // use the new locale
+ locale: 'mylocale'
+};
+
+
+
Available locales
+
+Graph2d comes with support for the following locales:
+
+
+
Language
Code
+
+
English
+
+ en
+ en_EN
+ en_US
+
+
+
+
Dutch
+
+ nl
+ nl_NL
+ nl_BE
+
+
+
+
Styles
- All parts of the Graph2d have a class name and a default css style just like the Timeline.
+ All parts of the Graph2d have a class name and a default css style just like the Graph2d.
The styles can be overwritten, which enables full customization of the layout
of the Graph2d.
Additionally, Graph2d has 10 preset styles for graphs, which are cycled through when loading groups. These styles can be overwritten
- as well, along with defining your own classes to style the graphs! Example 4 and
- example 5 show the usage of custom styles.
+ as well, along with defining your own classes to style the graphs! Example 4 and
+ example 5 show the usage of custom styles.
Select a locale for the Timeline. See section Localization for more information.
+
+
+
+
locales
+
Object
+
none
+
A map with i18n locales. See section Localization for more information.
+
+
margin.axis
Number
@@ -985,11 +1000,67 @@ var options = {
callback(null); // cancel updating the item
}
}
-}
+};
A full example is available here: 08_edit_items.html.
+
Localization
+
+ Timeline can be localized. For localization, Timeline depends largely on the localization of moment.js. Locales are not included in vis.js by default. To enable localization, moment.js must be loaded with locales. Moment.js offers a bundle named "moment-with-locales.min.js" for this and there are various alternative ways to load locales.
+
+
+
+ To set a locale for the Timeline, specify the option locale:
+
+
+
var options = {
+ locale: 'nl'
+};
+
+
+
Create a new locale
+
+To load a locale into the Timeline not supported by default, one can add a new locale to the option locales:
+
+
var options = {
+ locales: {
+ // create a new locale
+ mylocale: {
+ current: 'current',
+ time: 'time',
+ }
+ },
+
+ // use the new locale
+ locale: 'mylocale'
+};
+
+
+
Available locales
+
+Timeline comes with support for the following locales:
+
+
+
Language
Code
+
+
English
+
+ en
+ en_EN
+ en_US
+
+
+
+
Dutch
+
+ nl
+ nl_NL
+ nl_BE
+
+
+
+
Styles
@@ -1008,7 +1079,6 @@ A full example is available here: Data Policy