Skip to content

Commit

Permalink
prepare release
Browse files Browse the repository at this point in the history
  • Loading branch information
konstantin committed Dec 9, 2014
1 parent 2e82727 commit 8445022
Show file tree
Hide file tree
Showing 17 changed files with 371 additions and 96 deletions.
16 changes: 8 additions & 8 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ module.exports = function(grunt) {
{
src: 'plugins/tooltip.js',
dest: 'build/plugins/<%= pkg.name %>.tooltip.min.js'
}/*,
},
{
src: 'plugins/legend.js',
dest: 'build/plugins/<%= pkg.name %>.legend.min.js'
}*/
}
]

}
Expand All @@ -108,11 +108,11 @@ module.exports = function(grunt) {
{
src: 'css/tooltip.css',
dest: 'build/plugins/<%= pkg.name %>.tooltip.min.css'
}/*,
},
{
src: 'css/legend.css',
dest: 'build/plugins/<%= pkg.name %>.legend.min.css'
}*/
}
]
}
},
Expand All @@ -134,19 +134,19 @@ module.exports = function(grunt) {
{
src: 'plugins/tooltip.js',
dest: 'build/plugins/<%= pkg.name %>.tooltip.js'
}/*,
},
{
src: 'plugins/legend.js',
dest: 'build/plugins/<%= pkg.name %>.legend.js'
}*/,
},
{
src: 'css/tooltip.css',
dest: 'build/plugins/<%= pkg.name %>.tooltip.css'
}/*,
},
{
src: 'css/legend.css',
dest: 'build/plugins/<%= pkg.name %>.legend.css'
}*/
}
]
}
},
Expand Down
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.2.2",
"version": "0.2.3",
"homepage": "https://github.com/TargetProcess/tauCharts",
"description": "Simple charts library based on d3",
"keywords": [
Expand Down
51 changes: 51 additions & 0 deletions build/css/tauCharts.graphic-elements.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,54 @@
.graphical-report__layout {
display: -webkit-box;
display: -webkit-flexbox;
display: -ms-flexbox;
display: flex;
-ms-flex-align: stretch;
-webkit-align-items: stretch;
align-items: stretch;
-ms-flex-direction: column;
-webkit-box-orient: vertical;
flex-direction: column;
height: 100%;
overflow: auto;
}
.graphical-report__layout__header {
-ms-flex: 0 1 auto;
-webkit-box-flex: 0 1 auto;
flex: 0 1 auto;
}
.graphical-report__layout__container {
display: -webkit-box;
display: -webkit-flexbox;
display: -ms-flexbox;
display: flex;
-ms-flex: 1 1 auto;
-webkit-box-flex: 1 1 auto;
flex: 1 1 auto;
}
.graphical-report__layout__footer {
-ms-flex: 0 1 auto;
-webkit-box-flex: 0 1 auto;
flex: 0 1 auto;
}
.graphical-report__layout__sidebar {
-ms-flex: 0 1 auto;
-webkit-box-flex: 0 1 auto;
flex: 0 1 auto;
}
.graphical-report__layout__content {
-ms-flex: 1 0 auto;
-webkit-box-flex: 1 0 auto;
flex: 1 0 auto;
}
.graphical-report__layout__content div {
overflow: auto;
}
.graphical-report__layout__sidebar-right {
-ms-flex: 0 0 auto;
-webkit-box-flex: 0 0 auto;
flex: 0 0 auto;
}
/* region Generate .color@{n}-@{i} function */
.graphical-report__svg .color10-1 {
stroke: #e41a1c;
Expand Down
2 changes: 1 addition & 1 deletion build/css/tauCharts.graphic-elements.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 62 additions & 0 deletions build/plugins/tauCharts.legend.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
.graphical-report__legend {
padding: 20px;
width: 140px;
}
.graphical-report__legend__title,
.graphical-report__legend__item {
margin: 0 0 10px 0;
}
.graphical-report__legend__title {
text-transform: uppercase;
font-weight: 600;
font-size: 13px;
}
.graphical-report__legend__item {
padding-left: 25px;
position: relative;
font-size: 13px;
}
.graphical-report__legend__item:disabled,
.graphical-report__legend__item.disabled {
color: #cccccc;
}
.graphical-report__legend__example {
width: 15px;
height: 15px;
box-sizing: border-box;
border: 1px solid transparent;
border-radius: 50%;
position: absolute;
top: 0;
left: 0;
}
.graphical-report__legend__item .color10-1 {
background: #e41a1c;
}
.graphical-report__legend__item .color10-2 {
background: #377eb8;
}
.graphical-report__legend__item .color10-3 {
background: #4daf4a;
}
.graphical-report__legend__item .color10-4 {
background: #984ea3;
}
.graphical-report__legend__item .color10-5 {
background: #ff7f00;
}
.graphical-report__legend__item .color10-6 {
background: #e9e964;
}
.graphical-report__legend__item .color10-7 {
background: #a65628;
}
.graphical-report__legend__item .color10-8 {
background: #f781bf;
}
.graphical-report__legend__item .color10-9 {
background: #999999;
}
.graphical-report__legend__item .color10-10 {
background: #222222;
}
78 changes: 78 additions & 0 deletions build/plugins/tauCharts.legend.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
(function (factory) {
if (typeof define === "function" && define.amd) {
define(['tauCharts'], function (tauPlugins) {
return factory(tauPlugins);
});
} else if (typeof module === "object" && module.exports) {
var tauPlugins = require('tauCharts');
module.exports = factory();
} else {
factory(this.tauCharts);
}
})(function (tauCharts) {
var dfs = function (node) {
if (node.color && node.size) {
return node;
}
var i, children = node.unit || [], child, found;
for (i = 0; i < children.length; i += 1) {
child = children[i];
found = dfs(child);
if (found) {
return found;
}
}
};
var _ = tauCharts.api._;
var legend = function () {
return {
init: function (chart) {
if (this.isNeedLegend(chart)) {
this._container = chart.insertToRightSidebar(this.containerTemplate);
}
},
isNeedLegend: function (chart) {
var conf = chart.getConfig();
return Boolean(dfs(conf.spec.unit));
},
onUnitReady: function (chart, unit) {
if (unit.type.indexOf('ELEMENT') !== -1) {
this._unit = unit;
}
},
_getColorMap: function (chart) {
var color = this._unit.options.color;
var colorDimension = color.dimension;
var data = chart.getData();
var keys = _.map(data, function (item) {
return item[colorDimension];
});
// debugger
return _.unique(keys).reduce(function (colorMap, item) {
colorMap[item] = color.get(item);
return colorMap;
}, {});
},
containerTemplate: '<div class="graphical-report__legend"></div>',
template: _.template('<div class="graphical-report__legend__title"><%=name%></div><%=items%>'),
itemTemplate: _.template([
'<div class="graphical-report__legend__item">',
'<div class="graphical-report__legend__example <%=color%>" ></div><%=value%>',
'</div>'
].join('')),
onRender: function (chart) {
if(this._container) {
var items = _.map(this._getColorMap(chart), function (item, key) {
return this.itemTemplate({color: item, value: key});
}, this).join('');
this._container.innerHTML = this.template({items: items, name: this._unit.options.color.dimension});
}
},
render: function () {

}

};
};
tauCharts.api.plugins.add('legend', legend);
});
1 change: 1 addition & 0 deletions build/plugins/tauCharts.legend.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions build/plugins/tauCharts.legend.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8445022

Please sign in to comment.