Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
vladminsky committed Jan 27, 2015
1 parent abd0d94 commit 1278a3b
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 32 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tauCharts",
"version": "0.3.13",
"version": "0.3.14",
"homepage": "https://github.com/TargetProcess/tauCharts",
"description": "Simple charts library based on d3",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion build/development/plugins/tauCharts.export.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
cursor: pointer;
text-decoration: none;
position: relative;
z-index: 100;
z-index: 10;
}
.graphical-report__export:hover {
opacity: 1;
Expand Down
13 changes: 7 additions & 6 deletions build/development/plugins/tauCharts.export.js
Original file line number Diff line number Diff line change
Expand Up @@ -6370,7 +6370,7 @@ define("../bower_components/fetch/fetch", function(){});
function exportTo(settings) {
return {
_createDataUrl: function (chart) {
var cssPromises = this.cssPaths.map(function (css) {
var cssPromises = this._cssPaths.map(function (css) {
return fetch(css).then(function (r) {
return r.text();
});
Expand Down Expand Up @@ -6406,8 +6406,8 @@ define("../bower_components/fetch/fetch", function(){});
}

var blob = new Blob([asArray.buffer], {type: "image/png"});
saveAs(blob);
});
saveAs(blob,(this._fileName || 'export') + '.png');
}.bind(this));
},
_toPrint: function (chart) {
this._createDataUrl(chart)
Expand Down Expand Up @@ -6555,7 +6555,8 @@ define("../bower_components/fetch/fetch", function(){});
},
init: function (chart) {
settings = settings || {};
this.cssPaths = settings.cssPaths;
this._cssPaths = settings.cssPaths;
this._fileName = settings.fileName;
if (!this.cssPaths) {
this.cssPaths = [];
tauCharts.api.globalSettings.log('You should specified cssPath for correct work export plugin', 'warn');
Expand All @@ -6566,8 +6567,8 @@ define("../bower_components/fetch/fetch", function(){});
});
popup.content([
'<ul class="graphical-report__export__list">',
'<li class="graphical-report__export__item"><a href="#" data-value="print" tabindex="1">print</a></li>',
'<li class="graphical-report__export__item"><a href="#" data-value="png" tabindex="2">export to png</a></li>',
'<li class="graphical-report__export__item"><a href="#" data-value="print" tabindex="1">Print</a></li>',
'<li class="graphical-report__export__item"><a href="#" data-value="png" tabindex="2">Export to png</a></li>',
'</ul>'
].join(''));
popup.attach(this._container);
Expand Down
48 changes: 34 additions & 14 deletions build/development/tauCharts.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! taucharts - v0.3.13 - 2015-01-26
/*! taucharts - v0.3.14 - 2015-01-27
* https://github.com/TargetProcess/tauCharts
* Copyright (c) 2015 Taucraft Limited; Licensed Apache License 2.0 */
(function (root, factory) {
Expand Down Expand Up @@ -4660,7 +4660,7 @@ define('elements/interval',["exports", "../utils/utils-draw", "../const"], funct

var getSizesParams = function (params) {
var countDomainValue = params.domain().length;
var countCategory = params.category.length;
var countCategory = params.categoryLength;
var tickWidth = params.size / countDomainValue;
var intervalWidth = tickWidth / (countCategory + 1);
return {
Expand All @@ -4672,7 +4672,7 @@ define('elements/interval',["exports", "../utils/utils-draw", "../const"], funct

var flipHub = {

NORM: function (node, xScale, yScale, width, height, defaultSizeParams, category) {
NORM: function (node, xScale, yScale, colorIndexScale, width, height, defaultSizeParams) {
var minimalHeight = 1;
var yMin = Math.min.apply(Math, _toArray(yScale.domain()));
var isYNumber = !isNaN(yMin);
Expand All @@ -4681,7 +4681,7 @@ define('elements/interval',["exports", "../utils/utils-draw", "../const"], funct

var _ref = isXNumber ? defaultSizeParams : getSizesParams({
domain: xScale.domain,
category: category,
categoryLength: colorIndexScale.count(),
size: width
});
var tickWidth = _ref.tickWidth;
Expand Down Expand Up @@ -4713,14 +4713,14 @@ define('elements/interval',["exports", "../utils/utils-draw", "../const"], funct
return height - yScale(d[node.y.scaleDim]);
};

var calculateTranslate = function (d, index) {
return utilsDraw.translate(index * offsetCategory + offsetCategory / 2, 0);
var calculateTranslate = function (d) {
return utilsDraw.translate(colorIndexScale(d) * offsetCategory + offsetCategory / 2, 0);
};

return { calculateX: calculateX, calculateY: calculateY, calculateWidth: calculateWidth, calculateHeight: calculateHeight, calculateTranslate: calculateTranslate };
},

FLIP: function (node, xScale, yScale, width, height, defaultSizeParams, category) {
FLIP: function (node, xScale, yScale, colorIndexScale, width, height, defaultSizeParams) {
var minimalHeight = 1;
var xMin = Math.min.apply(Math, _toArray(xScale.domain()));
var isXNumber = !isNaN(xMin);
Expand All @@ -4729,7 +4729,7 @@ define('elements/interval',["exports", "../utils/utils-draw", "../const"], funct

var _ref2 = isYNumber ? defaultSizeParams : getSizesParams({
domain: yScale.domain,
category: category,
categoryLength: colorIndexScale.count(),
size: height
});
var tickWidth = _ref2.tickWidth;
Expand Down Expand Up @@ -4760,8 +4760,8 @@ define('elements/interval',["exports", "../utils/utils-draw", "../const"], funct
var calculateHeight = function (d) {
return intervalWidth;
};
var calculateTranslate = function (d, index) {
return utilsDraw.translate(0, index * offsetCategory + offsetCategory / 2);
var calculateTranslate = function (d) {
return utilsDraw.translate(0, colorIndexScale(d) * offsetCategory + offsetCategory / 2);
};

return { calculateX: calculateX, calculateY: calculateY, calculateWidth: calculateWidth, calculateHeight: calculateHeight, calculateTranslate: calculateTranslate };
Expand All @@ -4775,14 +4775,34 @@ define('elements/interval',["exports", "../utils/utils-draw", "../const"], funct
yScale = options.yScale,
colorScale = options.color;

var categories = node.groupBy(node.partition(), node.color.scaleDim);
var method = flipHub[node.flip ? "FLIP" : "NORM"];
var facetNode = node.parentUnit.parentUnit || node.parentUnit;
var _method = method(node, xScale, yScale, options.width, options.height, {

var allCategories = node.groupBy(node.source(), node.color.scaleDim);
var categories = node.groupBy(node.partition(), node.color.scaleDim);

var colorIndexScale = function (d) {
var index = 0;
var targetKey = JSON.stringify(d.key);
_.find(allCategories, function (catItem, catIndex) {
var isFound = JSON.stringify(catItem.key) === targetKey;
if (isFound) {
index = catIndex;
}
return isFound;
});

return index;
};

colorIndexScale.count = function () {
return allCategories.length;
};

var _method = method(node, xScale, yScale, colorIndexScale, options.width, options.height, {
tickWidth: 5,
intervalWidth: 5,
offsetCategory: 0
}, node.groupBy(facetNode.partition(), node.color.scaleDim));
});

var calculateX = _method.calculateX;
var calculateY = _method.calculateY;
Expand Down
4 changes: 2 additions & 2 deletions build/production/tauCharts.min.css

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions build/production/tauCharts.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tauCharts",
"version": "0.3.13",
"version": "0.3.14",
"ignore": [
"/*",
"!build/**",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "taucharts",
"version": "0.3.13",
"version": "0.3.14",
"homepage": "https://github.com/TargetProcess/tauCharts",
"description": "Simple charts library based on d3",
"author": {
Expand Down

0 comments on commit 1278a3b

Please sign in to comment.