Debian Codegraph @

examples/chartstyles.html

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 <html>
2 <head>
3 <title>JSXGraph example</title>
4 <link rel="stylesheet" type="text/css" href="../distrib/jsxgraph.css" />
5
6 <script type="text/javascript" src="../distrib/jsxgraphcore.js"></script>
7 <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.js"></script>
8 </head>
9 <body>
10
11 <h2>Playground to test things temporarily. May change very often.</h2>
12
13 <input type="button" value="Line chart" onClick="lineChart()">
14 <input type="button" value="Spline chart" onClick="splineChart()">
15 <input type="button" value="Bar chart" onClick="barChart()">
16 <input type="button" value="Multiple styles" onClick="multiStyleChart()">
17 <input type="button" value="Two bar charts" onClick="twoBarCharts()">
18 <input type="button" value="Horizontal bars" onClick="horizontalBarChart()">
19 <input type="button" value="Dynamic bars" onClick="dynamicBarChart()">
20 <input type="button" value="Regression line" onClick="fitChart(1)">
21 <input type="button" value="Regression parabola" onClick="fitChart(2)">
22 <div style="width:800px">
23 <div id="jxgbox" class="jxgbox" style="width:800px; height:800px; float:left;"></div>
24 </div>
25
26 <div id="debug" style="display:block;">DEBUG</div>
27 <script type="text/javascript">
28 /* <![CDATA[ */
29
30 var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-1, 10, 11, -2], axis: true});
31 var dataArr = [4,1,3,2,5,7,1.5,2];
32
33 // Line chart
34 function lineChart() {
35 JXG.JSXGraph.freeBoard(board);
36 board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-1, 10, 11, -2], axis: true});
37 board.suspendUpdate();
38 var a = board.create('chart', dataArr, {chartStyle:'line',strokeWidth:4,strokeColor:'#0000ff'});
39 board.unsuspendUpdate();
40 };
41
42 // Line chart with cubic splines
43 function splineChart() {
44 JXG.JSXGraph.freeBoard(board);
45 board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-1, 10, 11, -2], axis: true});
46 board.suspendUpdate();
47 var a = board.create('chart', dataArr, {chartStyle:'spline',strokeWidth:4,strokeColor:'#0000ff'});
48 board.unsuspendUpdate();
49 };
50
51 // Bar chart
52 function barChart() {
53 JXG.JSXGraph.freeBoard(board);
54 board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-1, 10, 11, -2], axis: true});
55 board.suspendUpdate();
56 var a = board.create('chart', dataArr, {chartStyle:'bar',width:0.6,labels:dataArr});
57 board.unsuspendUpdate();
58 };
59
60 // Single chart with multiple styles
61 function multiStyleChart() {
62 JXG.JSXGraph.freeBoard(board);
63 board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-1, 10, 11, -2], axis: true});
64 board.suspendUpdate();
65 var a = board.create('chart', dataArr, {chartStyle:'bar,line,point',width:0.8,size:4,labels:dataArr});
66 board.unsuspendUpdate();
67 };
68
69 // Two bar charts
70 function twoBarCharts() {
71 JXG.JSXGraph.freeBoard(board);
72 board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-1, 10, 11, -2], axis: true});
73 board.suspendUpdate();
74 var a = board.create('chart', [[1,3,5,7],[4,-1,3,2]], {chartStyle:'bar',width:0.8});
75 var b = board.create('chart', [[2,4,6,8],[3,1,2,5]], {chartStyle:'bar',fillColor:'#C3D9FF',width:0.8});
76 board.unsuspendUpdate();
77 };
78
79 // Bar chart with horizontal bars
80 function horizontalBarChart() {
81 JXG.JSXGraph.freeBoard(board);
82 board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-1, 10, 11, -2], axis: true});
83 board.suspendUpdate();
84 var a = board.create('chart', dataArr, {chartStyle:'bar',labels:dataArr,width:0.8,dir:'horizontal'});
85 board.unsuspendUpdate();
86 };
87
88 // Single chart with dynamic entries
89 function dynamicBarChart() {
90 JXG.JSXGraph.freeBoard(board);
91 board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-1, 10, 11, -2], axis: true});
92 board.suspendUpdate();
93 var s = board.create('slider', [[5,-1],[8,-1], [1,1,2]], {name:'S'});
94 var f = [function(){return Math.round(s.Value()*4,2);},
95 function(){return Math.round(s.Value()*(-1),2);},
96 function(){return Math.round(s.Value()*3,2);},
97 function(){return Math.round(s.Value()*2,2);}];
98 var chart = board.create('chart', [f], {chartStyle:'bar',width:0.8,labels:f});
99 board.unsuspendUpdate();
100 };
101
102 // Regression curve
103 function fitChart(deg) {
104 JXG.JSXGraph.freeBoard(board);
105 board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-1, 10, 11, -2], axis: true});
106 board.suspendUpdate();
107 var a = board.create('chart', dataArr,
108 {chartStyle:'bar,fit', degree:deg, colorArray:['#B02B2C','#3F4C6B','#C79810','#D15600'], dash:2}
109 );
110 board.unsuspendUpdate();
111 }
112 lineChart();
113 /* ]]> */
114 </script>
115 </body>
116 </html>