Skip to content

Commit

Permalink
closes #12, #10
Browse files Browse the repository at this point in the history
  • Loading branch information
benkeen committed Jun 7, 2014
1 parent a99e889 commit 680eaaa
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 2 deletions.
10 changes: 10 additions & 0 deletions d3pie-source/_labels.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ var labels = {
var quarter = Math.floor(angle / 90);
var midPoint = 4;
var x2, y2, x3, y3;

// this resolves an issue when the
if (quarter === 2 && angle === 180) {
quarter = 1;
}

switch (quarter) {
case 0:
x2 = pie.outerLabelGroupData[i].x - labelXMargin - ((pie.outerLabelGroupData[i].x - labelXMargin - originCoords.x) / 2);
Expand Down Expand Up @@ -346,6 +352,10 @@ var labels = {
},

checkConflict: function(pie, currIndex, direction, size) {
if (size <= 1) {
return;
}

var currIndexHemisphere = pie.outerLabelGroupData[currIndex].hs;
if (direction === "clockwise" && currIndexHemisphere != "right") {
return;
Expand Down
10 changes: 10 additions & 0 deletions d3pie/d3pie.js
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,12 @@ var labels = {
var quarter = Math.floor(angle / 90);
var midPoint = 4;
var x2, y2, x3, y3;

// this resolves an issue when the
if (quarter === 2 && angle === 180) {
quarter = 1;
}

switch (quarter) {
case 0:
x2 = pie.outerLabelGroupData[i].x - labelXMargin - ((pie.outerLabelGroupData[i].x - labelXMargin - originCoords.x) / 2);
Expand Down Expand Up @@ -934,6 +940,10 @@ var labels = {
},

checkConflict: function(pie, currIndex, direction, size) {
if (size <= 1) {
return;
}

var currIndexHemisphere = pie.outerLabelGroupData[currIndex].hs;
if (direction === "clockwise" && currIndexHemisphere != "right") {
return;
Expand Down
2 changes: 1 addition & 1 deletion d3pie/d3pie.min.js

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions website/examples/single.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!DOCTYPE html>
<html>
<head>
<title>d3pie examples</title>
</head>
<body>
<h1>
<a href="../../#examples">Standalone Examples</a> &raquo; Single Item
</h1>

<p>
A pie chart with a single item. Thrilling stuff, really.
</p>

<hr size="1" />

<div id="pie"></div>

<script src="../libs/jquery.js"></script>
<script src="../libs/d3.min.js"></script>
<script src="../../d3pie/d3pie.js"></script>

<script>
var pie = new d3pie("pie", {
header: {
title: {
text: "A Pie with One Item",
fontSize: 30
}
},
data: {
content: [
{ label: "JavaScript", value: 50 }
]
}
});
</script>

<hr size="1" />

<blockquote><pre>
var pie = new d3pie("pie", {
header: {
title: {
text: "A Pie with One Item"
}
},
data: {
content: [
{ label: "JavaScript", value: 50 }
]
}
});
</pre></blockquote>

</body>
</html>
2 changes: 1 addition & 1 deletion website/pages/about/aboutPageDemoPies.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ define([], function() {
titleSubtitlePadding: 6
},
footer: {
text: "* We're not sure why several people regard Winnipeg as a Top 10 Fear.",
text: "* We're not sure why several people regard Winnipeg as a Top 15 Fear.",
color: "#999999",
fontSize: 10,
font: "open sans",
Expand Down

0 comments on commit 680eaaa

Please sign in to comment.