diff --git a/docs/graph2d/index.html b/docs/graph2d/index.html
index 9c659f7a..40a4866e 100644
--- a/docs/graph2d/index.html
+++ b/docs/graph2d/index.html
@@ -470,12 +470,11 @@ var options = {
Function |
|
Insert a custom function on how to format the label. The function will receive a numeric value and has to return a string. Default function is:
-
+
function (value) {
- return value;
-}
-
- which does nothing to it. |
+ return ''+value.toPrecision(3);
+}
+
dataAxis.left.range.min |
diff --git a/lib/timeline/DataStep.js b/lib/timeline/DataStep.js
index 9bc67fec..96453387 100644
--- a/lib/timeline/DataStep.js
+++ b/lib/timeline/DataStep.js
@@ -190,21 +190,11 @@ DataStep.prototype.previous = function() {
DataStep.prototype.getCurrent = function() {
// prevent round-off errors when close to zero
var current = (Math.abs(this.current) < this.step / 2) ? 0 : this.current;
- var returnValue = current.toPrecision(5);
+ var returnValue = current;
if (typeof this.formattingFunction === 'function') {
- returnValue = this.formattingFunction(current);
+ return this.formattingFunction(current);
}
-
- if (typeof returnValue === 'number') {
- return '' + returnValue;
- }
- else if (typeof returnValue === 'string') {
- return returnValue;
- }
- else {
- return current.toPrecision(5);
- }
-
+ return '' + returnValue.toPrecision(3);
};
/**
diff --git a/lib/timeline/component/DataAxis.js b/lib/timeline/component/DataAxis.js
index 4a1291a3..269a3f7d 100644
--- a/lib/timeline/component/DataAxis.js
+++ b/lib/timeline/component/DataAxis.js
@@ -19,7 +19,7 @@ function DataAxis (body, options, svg, linegraphOptions) {
orientation: 'left', // supported: 'left', 'right'
showMinorLabels: true,
showMajorLabels: true,
- icons: true,
+ icons: false,
majorLinesOffset: 7,
minorLinesOffset: 4,
labelOffsetX: 10,
@@ -30,12 +30,12 @@ function DataAxis (body, options, svg, linegraphOptions) {
alignZeros: true,
left:{
range: {min:undefined,max:undefined},
- format: function (value) {return value;},
+ format: function (value) {return ''+value.toPrecision(3);},
title: {text:undefined,style:undefined}
},
right:{
range: {min:undefined,max:undefined},
- format: function (value) {return value;},
+ format: function (value) {return ''+value.toPrecision(3);},
title: {text:undefined,style:undefined}
}
};
diff --git a/lib/timeline/component/Legend.js b/lib/timeline/component/Legend.js
index 0843db38..f00222c8 100644
--- a/lib/timeline/component/Legend.js
+++ b/lib/timeline/component/Legend.js
@@ -8,7 +8,7 @@ var Component = require('./Component');
function Legend(body, options, side, linegraphOptions) {
this.body = body;
this.defaultOptions = {
- enabled: true,
+ enabled: false,
icons: true,
iconSize: 20,
iconSpacing: 6,
@@ -21,6 +21,7 @@ function Legend(body, options, side, linegraphOptions) {
position: 'top-left' // top/bottom - left,center,right
}
}
+
this.side = side;
this.options = util.extend({},this.defaultOptions);
this.linegraphOptions = linegraphOptions;
diff --git a/lib/timeline/component/LineGraph.js b/lib/timeline/component/LineGraph.js
index bfdbaeb2..2ea127d5 100644
--- a/lib/timeline/component/LineGraph.js
+++ b/lib/timeline/component/LineGraph.js
@@ -50,40 +50,8 @@ function LineGraph(body, options) {
size: 6,
style: 'square' // square, circle
},
- dataAxis: {
- showMinorLabels: true,
- showMajorLabels: true,
- icons: false,
- width: '40px',
- visible: true,
- alignZeros: true,
- left: {
- range: {min: undefined, max: undefined},
- format: function (value) {
- return value;
- },
- title: {text: undefined, style: undefined}
- },
- right: {
- range: {min: undefined, max: undefined},
- format: function (value) {
- return value;
- },
- title: {text: undefined, style: undefined}
- }
- },
- legend: {
- enabled: false,
- icons: true,
- left: {
- visible: true,
- position: 'top-left' // top/bottom - left,right
- },
- right: {
- visible: true,
- position: 'top-right' // top/bottom - left,right
- }
- },
+ dataAxis: {}, //Defaults are done on DataAxis level
+ legend: {}, //Defaults are done on Legend level
groups: {
visibility: {}
}