Skip to content

Commit

Permalink
- Allow to define order for a bar charts (#105)
Browse files Browse the repository at this point in the history
- Make time scale nice (#145)
- The "autoScale" property is deprecated (use "nice" instead)
- Remove shades for bars in Safari
- Allow to specify label for any field in tooltip
  • Loading branch information
vladminsky committed Mar 29, 2016
1 parent f5ff347 commit 6260111
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 23 deletions.
2 changes: 1 addition & 1 deletion build/development/css/tauCharts.css
Expand Up @@ -480,7 +480,7 @@
stroke: #fff;
}
.graphical-report__bar-stacked {
shape-rendering: crispEdges;
shape-rendering: auto;
transition: opacity 0.2s ease;
stroke-opacity: 0.5;
stroke-width: 1;
Expand Down
2 changes: 1 addition & 1 deletion build/development/css/tauCharts.dark.css
Expand Up @@ -480,7 +480,7 @@
stroke: #fff;
}
.graphical-report__bar-stacked {
shape-rendering: crispEdges;
shape-rendering: auto;
transition: opacity 0.2s ease;
stroke-opacity: 0.5;
stroke-width: 1;
Expand Down
2 changes: 1 addition & 1 deletion build/development/css/tauCharts.default.css
Expand Up @@ -480,7 +480,7 @@
stroke: #fff;
}
.graphical-report__bar-stacked {
shape-rendering: crispEdges;
shape-rendering: auto;
transition: opacity 0.2s ease;
stroke-opacity: 0.5;
stroke-width: 1;
Expand Down
36 changes: 30 additions & 6 deletions build/development/plugins/tauCharts.tooltip.js
Expand Up @@ -401,13 +401,37 @@
}
});

var toLabelValuePair = function (x) {

var res = {};

if (_.isFunction(x) || _.isString(x)) {
res = {format: x};
} else if (_.isObject(x)) {
res = _.pick(x, 'label', 'format', 'nullAlias');
}

return res;
};

Object.keys(settings.formatters).forEach(function (k) {
var fmt = settings.formatters[k];
info[k] = info[k] || {label: k, nullAlias: ('No ' + k)};
info[k].format = (_.isFunction(fmt) ?
(fmt) :
(tauCharts.api.tickFormat.get(fmt, info[k].nullAlias))
);

var fmt = toLabelValuePair(settings.formatters[k]);

info[k] = _.extend(
({label: k, nullAlias: ('No ' + k)}),
(info[k] || {}),
(_.pick(fmt, 'label', 'nullAlias')));

if (fmt.hasOwnProperty('format')) {
info[k].format = (_.isFunction(fmt.format) ?
(fmt.format) :
(tauCharts.api.tickFormat.get(fmt.format, info[k].nullAlias)));
} else {
info[k].format = (info[k].hasOwnProperty('format')) ?
(info[k].format) :
(tauCharts.api.tickFormat.get(null, info[k].nullAlias));
}
});

return {
Expand Down
11 changes: 8 additions & 3 deletions build/development/tauCharts.js
@@ -1,4 +1,4 @@
/*! taucharts - v0.8.1 - 2016-03-24
/*! taucharts - v0.8.1 - 2016-03-29
* https://github.com/TargetProcess/tauCharts
* Copyright (c) 2016 Taucraft Limited; Licensed Apache License 2.0 */
(function webpackUniversalModuleDefinition(root, factory) {
Expand Down Expand Up @@ -2400,6 +2400,7 @@ return /******/ (function(modules) { // webpackBootstrap
}

this.size = fnCreateScale('size', config.size, sizeGuide);
this.sizeMin = sizeGuide.min;
this.sizeMax = sizeGuide.max;

return this.regScale('x', this.xScale).regScale('y', this.yScale).regScale('size', this.size).regScale('color', this.color);
Expand Down Expand Up @@ -2445,8 +2446,9 @@ return /******/ (function(modules) { // webpackBootstrap
colorScale: colorScale,
isHorizontal: isHorizontal,
barsGap: barsGap,
minSize: this.sizeMin,
maxSize: this.sizeMax,
dataSource: fullData
dataSource: frames[0].full()
});

var params = { prettify: prettify, xScale: xScale, yScale: yScale, minBarH: 1, minBarW: 1, baseCssClass: baseCssClass };
Expand Down Expand Up @@ -2616,6 +2618,7 @@ return /******/ (function(modules) { // webpackBootstrap
var colorScale = _ref5.colorScale;
var barsGap = _ref5.barsGap;
var dataSource = _ref5.dataSource;
var minSize = _ref5.minSize;
var maxSize = _ref5.maxSize;

var enableColorToBarPosition = this.config.guide.enableColorToBarPosition;
Expand All @@ -2626,6 +2629,7 @@ return /******/ (function(modules) { // webpackBootstrap
sizeScale: sizeScale,
colorScale: colorScale,
barsGap: barsGap,
minSize: minSize,
maxSize: maxSize,
dataSource: dataSource,
categories: enableColorToBarPosition ? colorScale.domain() : []
Expand Down Expand Up @@ -2936,6 +2940,7 @@ return /******/ (function(modules) { // webpackBootstrap
key: 'decorator_size_distribute_evenly',
value: function decorator_size_distribute_evenly(model, _ref8) {
var dataSource = _ref8.dataSource;
var minSize = _ref8.minSize;
var maxSize = _ref8.maxSize;


Expand All @@ -2962,7 +2967,7 @@ return /******/ (function(modules) { // webpackBootstrap

return IntervalModel.compose(model, {
size: function size() {
return Math.min(maxSize, diff);
return Math.max(minSize, Math.min(maxSize, diff));
}
});
}
Expand Down
4 changes: 2 additions & 2 deletions build/production/tauCharts.dark.min.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions build/production/tauCharts.default.min.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions build/production/tauCharts.min.css

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions build/production/tauCharts.min.js

Large diffs are not rendered by default.

0 comments on commit 6260111

Please sign in to comment.