File: barchart.html

package info (click to toggle)
jsxgraph 1.10.1%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 24,804 kB
  • sloc: javascript: 82,299; xml: 5,869; java: 1,072; php: 281; makefile: 184; python: 174; cpp: 76; sh: 12
file content (44 lines) | stat: -rw-r--r-- 2,321 bytes parent folder | download | duplicates (3)
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
<html>
    <head>
        <title></title>
        <script type="text/javascript" src="jquery-3.5.1.min.js"></script>
        <script type="text/javascript" src="../distrib/jsxgraphcore.js"></script>
    </head>
    <body class="jsxgraph_body">
        <div id="jxgbox" class="jxgbox" style="width:700; height:600;"></div>
        <!-- Drawing area -->
        <script type="text/javascript">
            /* <![CDATA[ */
            board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-1, 9, 13, -3], axis:true});


            var s = board.create('slider', [[8,7],[11,7],[1,1,1.5]], {name:'S', strokeColor:'black', fillColor:'white'});
            var f = [function(){return (s.Value()*4.5).toFixed(2);},
                     function(){return (s.Value()*(-1)).toFixed(2);},
                     function(){return (s.Value()*3).toFixed(2);},
                     function(){return (s.Value()*2).toFixed(2);},
                     function(){return (s.Value()*(-0.5)).toFixed(2);},
                     function(){return (s.Value()*5.5).toFixed(2);},
                     function(){return (s.Value()*2.5).toFixed(2);},
                     function(){return (s.Value()*(-0.75)).toFixed(2);},
                     function(){return (s.Value()*3.5).toFixed(2);},
                     function(){return (s.Value()*2).toFixed(2);},
                     function(){return (s.Value()*(-1.25)).toFixed(2);}
                     ];
            var chart = board.create('chart', [f],
                                            {chartStyle:'bar',width:0.8,labels:f,
                                             colorArray:['#8E1B77','#BE1679','#DC1765','#DA2130','#DB311B','#DF4917','#E36317','#E87F1A',
                                                         '#F1B112','#FCF302','#C1E212']});

            var dataArr = [4,1,3,2,5,6.5,1.5,2,0.5,1.5,-1];
            var chart2 = board.create('chart', dataArr, {chartStyle:'line,point'});
            chart2[0].setAttribute('strokeColor:black','strokeWidth:2pt');
            for(var i=0; i<11;i++) {
                chart2[1][i].setAttribute({strokeColor:'black',fillColor:'white',face:'[]', size:4, strokeWidth:'2pt'});
            }
            board.unsuspendUpdate();

        /* ]]> */
        </script>
    </body>
</html>