1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
4
<meta http-equiv="content-type" content="text/html; charset=utf-8">
6
/*Supplemental: CSS for the YUI distribution*/
7
#custom-doc { width: 95%; min-width: 950px; }
8
#pagetitle {background-image: url(../../assets/bg_hd.gif);}
10
padding:10px 10px 10px 10px;
13
<link rel="stylesheet" type="text/css" href="../../../build/cssfonts/fonts-min.css">
15
<body class="yui3-skin-sam">
17
<div id="mychart"></div>
18
<script type="text/javascript" src="../../../build/yui/yui.js"></script>
22
filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'min'
23
}).use('charts', 'test', 'console', function (Y)
25
Y.namespace("example.test");
27
var suite = new Y.Test.Suite("Y.Charts.Pie"),
29
//test to ensure that pie charts are drawn from center
30
//pie charts need to have the same width/height
31
PieCenterTest = new Y.Test.Case({
32
name: "PieChartCenterTest",
35
{day:"Monday", taxes:2000},
36
{day:"Tuesday", taxes:50},
37
{day:"Wednesday", taxes:4000},
38
{day:"Thursday", taxes:200},
39
{day:"Friday", taxes:2000}
41
var mychart = new Y.Chart({type: "pie", width:400, height:400, dataProvider:myDataValues});
42
mychart.render("#mychart");
46
tearDown: function() {
50
testWidthAndHeightEqual: function()
52
var graphic = this.chart.get("graph").get("graphic"),
53
shapes = graphic.get("shapes"),
58
if(shapes.hasOwnProperty(i))
61
Y.assert(shape.get("width") === shape.get("height"));
66
testWidthGreaterThanHeight: function()
68
var graphic = this.chart.get("graph").get("graphic"),
72
this.chart.set("width", 500);
73
shapes = graphic.get("shapes");
76
if(shapes.hasOwnProperty(i))
79
Y.assert(shape.get("width") === shape.get("height"));
84
testHeightGreaterThanWidth: function()
86
var graphic = this.chart.get("graph").get("graphic"),
90
this.chart.set("height", 600);
91
shapes = graphic.get("shapes");
94
if(shapes.hasOwnProperty(i))
97
Y.assert(shape.get("width") === shape.get("height"));
103
suite.add(PieCenterTest);
106
var r = new Y.Console({
108
style: 'block' // to anchor in the example content
111
r.render('#testLogger');
114
Y.Test.Runner.setName("Y.Charts.Pie");
115
Y.Test.Runner.add(suite);