For PR #209, adding test pieChart to pieChartTest.html.
Making 'key' the default label type if none specified.
This commit is contained in:
parent
ce3de0d95c
commit
3dbdde795f
@ -339,6 +339,7 @@ nv.models.pie = function() {
|
||||
chart.labelType = function(_) {
|
||||
if (!arguments.length) return labelType;
|
||||
labelType = _;
|
||||
labelType = labelType || "key";
|
||||
return chart;
|
||||
};
|
||||
|
||||
|
@ -38,6 +38,11 @@ text {
|
||||
<svg></svg>
|
||||
</div>
|
||||
|
||||
<div class='chart third' id='test7'>
|
||||
<h2>Pie chart with percent label type</h2>
|
||||
<svg></svg>
|
||||
</div>
|
||||
|
||||
<div class='chart third' id="test4">
|
||||
<h2>Empty array passed in</h2>
|
||||
<svg></svg>
|
||||
@ -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");
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user