Skip to content

Commit

Permalink
updated DOMinate version
Browse files Browse the repository at this point in the history
  • Loading branch information
ad-si committed Mar 13, 2013
1 parent f5a8749 commit 82877ca
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 32 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,2 +1,3 @@
.DS_Store
.idea/
.idea
.sass-cache
33 changes: 18 additions & 15 deletions index.html
@@ -1,30 +1,33 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>vectual.js</title>
<link rel="stylesheet" type="text/css" href="css/vectual.css"/>
<script src="https://raw.github.com/adius/DOMinate/master/src/dominate.extended.min.js"></script>
<script src="js/config.js"></script>
<script src="js/data.js"></script>
<script type="text/javascript" src="js/vectual.js"></script>
<meta charset="utf-8">
<title>vectual.js</title>
<link rel="stylesheet" type="text/css" href="css/vectual.css"/>
</head>
<body>

<h1>vectual.js</h1>

<div id="demo"></div>

<script src="https://raw.github.com/adius/DOMinate/master/src/dominate.min.js"></script>
<script src="js/config.js"></script>
<script src="js/data.js"></script>
<script src="js/vectual.js"></script>
<script>

vectual(fruitConsumption)
//.pieChart()
.barChart()
//.lineChart()
//.scatterChart()
//.map()
//.table()
//.tagCloud();
vectual(fruitConsumption)
.pieChart()
//.barChart()
//.lineChart()
//.tagCloud();

//.scatterChart()
//.map()
//.table()

</script>

</body>
</html>
31 changes: 15 additions & 16 deletions js/vectual.js
@@ -1,4 +1,5 @@
(function (window, document, undefined) {

var svg, //SVG DOM-fragment
svgNS = "http://www.w3.org/2000/svg", //SVG namespace
dom = DOMinate, //DOM-building utility
Expand Down Expand Up @@ -41,7 +42,7 @@
['g', {
'transform': 'translate(' + (0.5 * c.width) + ', ' + (0.5 * c.height) + ')'
}], svgNS
);
)[0];


function init() {
Expand All @@ -67,7 +68,7 @@
nextx,
nexty,
size = (((c.sorted.values[i] / c.totalValue) * 360) > 180) ? '0 1,0' : '0 0,0',
sector = dom(['g', {'class': "vectual_pie_sector"}], svgNS);
sector = dom(['g', {'class': "vectual_pie_sector"}], svgNS)[0];

function init() {

Expand All @@ -93,7 +94,7 @@
'style': 'stroke-width:' + (radius * 0.015) + ';fill:' + c.colors[i],
'd': 'M 0,0 L ' + lastx + ',' + lasty + ' A ' + radius + ',' + radius + ' ' + size + ' ' + nextx + ',' + nexty + ' z'}
], svgNS
);
)[0];

text = dom(
['text', {
Expand All @@ -105,15 +106,15 @@
'fill': c.colors[i],
'transform': 'translate(0, 5)'
}], svgNS
);
)[0];

title = dom(
['title',
c.sorted.keys[i] + ' | ' +
c.sorted.values[i] + ' | ' +
(Math.round(c.sorted.values[i] / c.totalValue * 100) ) + '%'
], svgNS
);
)[0];

}

Expand Down Expand Up @@ -246,9 +247,9 @@
['g', {
transform: 'translate(' + (graphWidth * 0.1) + ', ' + graphHeight + ')'
}], svgNS
),
coordinateSystem = dom(['g'], svgNS),
bars = dom(['g'], svgNS);
)[0],
coordinateSystem = dom(['g'], svgNS)[0],
bars = dom(['g'], svgNS)[0];


function buildCoordinateSystem() {
Expand Down Expand Up @@ -331,7 +332,7 @@
},
['title', c.keys[i] + ': ' + c.values[i]]
], svgNS
);
)[0];

function setAnimations() {
dom(
Expand Down Expand Up @@ -432,7 +433,7 @@
['g', {
'transform': 'translate(' + (graphWidth * 0.1) + ', ' + (graphHeight) + ')'
}], svgNS
);
)[0];

function init() {
dom([svg, [graph]]);
Expand Down Expand Up @@ -567,7 +568,7 @@

, ['title', c.keys[i] + ': ' + c.values[i]]
]
, svgNS);
, svgNS)[0];


graph.appendChild(circle);
Expand Down Expand Up @@ -631,7 +632,7 @@
transform: 'translate(' + (0.5 * c.width) + ', ' + (0.5 * c.height) + ')',
class: 'vectualTagcloud'
}], svgNS
);
)[0];

function init() {

Expand Down Expand Up @@ -853,8 +854,6 @@

c.range = c.max.value - c.min.value;

console.log(c);

//--------------------------------------------------------

svg = dom(
Expand Down Expand Up @@ -914,10 +913,10 @@
style: 'font-size:' + (c.height * 0.05) + 'px'
}]
]
, svgNS);
, svgNS)[0];


dom([document.getElementById(c.id) , [svg]]);
document.getElementById(c.id).appendChild(svg)

return {
pieChart: function () {
Expand Down

0 comments on commit 82877ca

Please sign in to comment.