1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/* <license>
* This file is part of the dis-Emi-A HaXe Library. Copyright © edA-qa mort-ora-y
* For full copyright and license information please refer to doc/license.txt.
* </license>
*/
package ui.test;
import ui.LayerPanel;
class ChartTest extends ui.StageLayout
{
static var data = [
[ 3.4, 1.2, 9.7, 13.2, 4.5 ] ,
[ null, 10.0, 11.5, 14.0, 9.0 ]
];
static var series = [ "You", "Max" ];
static var labels = [ "Data", "Frogs", "Squix", "Muggles", "Sampson" ];
var panel : LayerPanel;
public function new()
{
super();
MixinLayout();
var buttons = ui.LinearLayout.vertical();
layout.add( buttons );
panel = LayerPanel.exclusive();
layout.add( panel, ui.SizeType.Fill(1) );
var charts = [
[ "Line", ui.Chart.line( labels, series, data,
{ integralRange: true,
vertexShape: draw.fragments.Polygon.shape( { sides: 5 } ),
rangeLines: [ 7.6, 11.2 ],
} ) ],
[ "Pie", ui.Chart.pie( labels, data[0] ) ],
[ "Bar", ui.Chart.bar( labels, series, data,
{ highlightFirst: true, title: "My Bar Chart" } ) ],
[ "Pie2", ui.Chart.pie( labels, data[0],
{ verticalLegend: false }
) ],
[ "Pie3", ui.Chart.pie( labels, data[0],
{ verticalLegend: false, legendColumns: 3 }
) ],
];
for( i in 0...charts.length )
{
buttons.add( ui.Button.plain( ui.Action.bind1( onSelect, i ), charts[i][0] ) );
panel.add( charts[i][1] );
}
}
function onSelect( pi : Int )
{
panel.displayPanel( pi );
}
static public function main()
{
ui.StageLayout.setup( ChartTest );
}
define(IsHorizontalLayout,)
include(ui/MixinLayout.ihx)
}
|