~eda-qa/dhlib/main

« back to all changes in this revision

Viewing changes to lib/ui/test/ChartTest.mhx

  • Committer: edA-qa mort-ora-y
  • Date: 2010-02-16 05:36:32 UTC
  • Revision ID: eda-qa@disemia.com-20100216053632-60lt7fndfi3fgblw
first

Show diffs side-by-side

added added

removed removed

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