Skip to content

Commit

Permalink
#312 Fix the detection of Y axis on line chart
Browse files Browse the repository at this point in the history
  • Loading branch information
nadouani committed Nov 22, 2017
1 parent a562b9d commit da8c79a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
4 changes: 3 additions & 1 deletion ui/app/scripts/directives/dashboard/line.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@
scope.axes = {};
scope.colors = {};

var serieTypes = _.uniq(_.pluck(scope.options.series, 'type')).length;

_.each(scope.options.series, function(serie, index) {
var key = serie.field,
agg = serie.agg,
Expand All @@ -97,7 +99,7 @@

scope.types[columnKey] = serie.type || 'line';
scope.names[columnKey] = serie.label || (agg === 'count' ? 'count' : (agg + ' of ' + key));
scope.axes[columnKey] = (scope.types[columnKey] === 'bar') ? 'y2' : 'y';
scope.axes[columnKey] = serieTypes === 1 ? 'y' : ((scope.types[columnKey] === 'bar') ? 'y2' : 'y');
scope.colors[columnKey] = serie.color;
});

Expand Down
9 changes: 5 additions & 4 deletions ui/app/views/directives/charts/c3.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ <h4 class="text-danger">
</div>
<div class="c3-content" ng-show="!error">
<div ng-show="chart" class="clearfix">
<a class="pull-right ml-xs" href ng-csv="onSaveCsv"><i class="fa fa-file-text-o mr-xxxs"></i>Save as CSV</a>
<a class="pull-right" href ng-click="save()"><i class="fa fa-file-image-o mr-xxxs"></i>Save as image</a>
</div>
<div class="c3-chart" style="height:300px;">
<a class="pull-right ml-xxs" href ng-csv="onSaveCsv"><i class="fa fa-file-text-o mr-xxxs"></i>CSV</a>
<a class="pull-right ml-xxs" href ng-click="save()"><i class="fa fa-file-image-o mr-xxxs"></i>Image</a>
<strong class="text-primary pull-right">Save as</strong>
</div>
<div class="c3-chart">
<div styles="height:300px;" class="text-center"><i class="fa fa-spinner fa-spin fa-2x"></i><br>Loading...</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion ui/app/views/directives/dashboard/counter/view.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h4 class="text-danger">
</div>
<div ng-if="!error" class="row" ng-repeat="item in data">
<div class="col-md-4 text-right">
<h2>{{item.value}}</h2>
<h2>{{item.value | number}}</h2>
</div>
<div class="col-md-8">
<h2><small>{{item.label}}</small></h2>
Expand Down
2 changes: 1 addition & 1 deletion ui/app/views/directives/dashboard/item.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">
<i class="mr-xxs fa" ng-class="typeClasses[component.type]"></i>{{component.options.title}}
<i class="mr-xxs fa" ng-class="typeClasses[component.type]"></i>{{component.options.title || 'No title'}}
</h3>

<div class="box-tools pull-right">
Expand Down

0 comments on commit da8c79a

Please sign in to comment.