From 3dbdde795fef2a48f19114cba2563e5db891c801 Mon Sep 17 00:00:00 2001 From: Robin Hu Date: Wed, 7 Aug 2013 22:56:38 -0400 Subject: [PATCH] For PR #209, adding test pieChart to pieChartTest.html. Making 'key' the default label type if none specified. --- src/models/pie.js | 1 + test/pieChartTest.html | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/models/pie.js b/src/models/pie.js index ac58c00..475a78f 100644 --- a/src/models/pie.js +++ b/src/models/pie.js @@ -339,6 +339,7 @@ nv.models.pie = function() { chart.labelType = function(_) { if (!arguments.length) return labelType; labelType = _; + labelType = labelType || "key"; return chart; }; diff --git a/test/pieChartTest.html b/test/pieChartTest.html index cd70359..42ddd39 100644 --- a/test/pieChartTest.html +++ b/test/pieChartTest.html @@ -38,6 +38,11 @@ text { +
+

Pie chart with percent label type

+ +
+

Empty array passed in

@@ -103,7 +108,7 @@ function thirtySeries() { return data; } -function defaultChart(containerId, data) { +function defaultChart(containerId, data, labelType) { nv.addGraph(function() { var width = 500, height = 500; @@ -113,7 +118,9 @@ function defaultChart(containerId, data) { .y(function(d) { return d.y }) .color(d3.scale.category10().range()) .width(width) - .height(height); + .height(height) + .labelType(labelType) + ; d3.select("#" + containerId + " svg") .datum(data) @@ -164,4 +171,6 @@ defaultChart("test6", [ {key: "null", y: null}, {key: "zero", y: 0} ]) + +defaultChart("test7",testdata, "percent");