Commit 75530220 authored by Mathieu Rodic's avatar Mathieu Rodic

[ANOMALY] in graphs, Y-axis is now linear by default

parent dab2307e
...@@ -323,7 +323,7 @@ gargantext.controller("GraphController", function($scope, $http, $element) { ...@@ -323,7 +323,7 @@ gargantext.controller("GraphController", function($scope, $http, $element) {
options: { options: {
axes: { axes: {
x: {key: 'x', type: 'date'}, x: {key: 'x', type: 'date'},
y: {type: 'log'}, y: {type: 'linear', type: 'numeric'},
}, },
tension: 1.0, tension: 1.0,
lineMode: 'bundle', lineMode: 'bundle',
...@@ -384,15 +384,27 @@ gargantext.controller("GraphController", function($scope, $http, $element) { ...@@ -384,15 +384,27 @@ gargantext.controller("GraphController", function($scope, $http, $element) {
}); });
}); });
// Convert this object back to a sorted array // Convert this object back to a sorted array
var yMin, yMax;
var linearData = []; var linearData = [];
for (var x in dataObject) { for (var x in dataObject) {
var row = {x: convert(x)}; var row = {x: convert(x)};
var yList = dataObject[x]; var yList = dataObject[x];
for (var i=0; i<yList.length; i++) { for (var i=0; i<yList.length; i++) {
row['y' + i] = yList[i]; y = yList[i];
row['y' + i] = y;
if (yMax == undefined || y > yMax) {
yMax = y;
}
if (yMin == undefined || y < yMin) {
yMin = y;
}
} }
linearData.push(row); linearData.push(row);
} }
// Update the axis
$scope.graph.options.axes.y.min = yMin;
$scope.graph.options.axes.y.max = yMax;
$scope.graph.options.axes.y.ticks = 100;
// Finally, update the graph // Finally, update the graph
var series = []; var series = [];
for (var i=0, n=$scope.datasets.length; i<n; i++) { for (var i=0, n=$scope.datasets.length; i<n; i++) {
......
...@@ -273,7 +273,7 @@ ...@@ -273,7 +273,7 @@
<br/> <br/>
Y-axis: use a Y-axis: use a
<select ng-model="graph.options.axes.y.type" ng-options="type for type in ['log', 'linear']"></select> <select ng-model="graph.options.axes.y.type" ng-options="type for type in ['linear', 'log']"></select>
scale scale
<br/> <br/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment