?? graph2test.xml
字號:
<?xml version="1.0"?><Application> <Window caption="Chart Test (No XML Source)" width="500" height="400" centered="true"/> <Resources> <Script><![CDATA[function Graph2Test() { var d0 = new Date; var win = application.getWindow(); //var g = new BiGraph; var g = new BiGraph2; g.setChartType( "column" ); var f1 = function ( x ) { return x; }; var f2 = function ( x ) { return 5 * Math.sqrt(x) - 10; }; var n = 25; var cats = new Array( n ); var s1vals = new Array( n ); var s2vals = new Array( n ); for ( var i = 0; i < n; i++ ) { cats[i] = new BiChartCategory( g, "c" + i, String(i) ); s1vals[i] = f1(i); s2vals[i] = f2(i); } if ( typeof window.BiGraph == "function" && g instanceof BiGraph && !(g instanceof BiGraph2) ) { g.getValueAxis().setShowMajorTicks( false ); g.getValueAxis().setShowMinorTicks( false ); g.getCategoryAxis().setShowMajorTicks( false ); g.getCategoryAxis().setShowMinorTicks( false ); } g.setCategories( cats ); g.addSeries( new BiChartSeries(g, "s1", getFunctionText(f1), s1vals) ); g.addSeries( new BiChartSeries(g, "s2", getFunctionText(f2), s2vals) ); g.setBackColor( "white" ); //g.getValueAxis().setMaximum( 100 ); //g.getValueAxis().setMinimum( -100 ); g.getChartArea().setStrokeColor( "transparent" ); g.getChartArea().setFillColor( "#f8f8f8" ); g.getCategoryAxis().setMajorTickInterval( 5 ); //g.getCategoryAxis().setMinorTickInterval( 1 ); g.getGridLines().setMajorValueStrokeColor( "#ddd" ); g.setLocation(0, 0); g.setRight(0); g.setBottom(0); //g.setFontSize( 20 ); //g.getChartPresentation( "s1" ).setBarSpacing( 0 ); //g.getChartPresentation( "s1" ).setStrokeColor( "pink" ); //g.getChartPresentation( "s2" ).setStrokeColor( "lightgreen" ); g.getChartPresentation( "s1" ).setFillOpacity( 0.7 ); //g.getGridLines().setMajorValueStrokeColor( "red" ); g.getGridLines().setShowMinorValue( false ); //g.getGridLines().setShowMajorValue( false ); g.getGridLines().setShowMajorCategory( false ); g.getGridLines().setShowMinorCategory( false ); //g.getValueAxis().setShowLabels( false ); //g.getCategoryAxis().setShowLabels( false ); //g.getLegend().setVisible( false ); //g.getValueAxis().setVisible( false ); //g.getCategoryAxis().setVisible( false ); var d1 = new Date; win.add(g); var d2 = new Date; g.update(); var d3 = new Date; //g._gridLines._createMinorValueLines(); //g._gridLines._layoutMinorValueLines(); //g._gridLines._createMajorValueLines(); //g._gridLines._layoutMajorValueLines(); var t = d3 - d2; var dt = t / n * 2; //win.setCaption( (d3 - d0) + " - " + (d1 - d0) + " - " + (d2 - d1) + " - " + (d3 - d2) ); win.setCaption( win.getCaption() + " - " + t + ", " + dt ); ///// Chart type combo ///// var combo = new BiComboBox( ["column", "stackedcolumn", "percentagestackedcolumn", "bar", "stackedbar", "percentagestackedbar"] ); combo.setLocation( 30, 5 ); combo.setWidth( 160 ); var item = combo.findStringExact( g.getChartType() ); item.setSelected( true ); combo.addEventListener( "change", function (e) { g.setChartType( combo.getSelectedItem().getText() ); g.update(); }) win.add ( combo ); ///// End Chart type combo ///// ///// Animation ///// var v = 0; var r = 100; var t = new BiTimer( 100 ); t.addEventListener("tick", function (e) { var series = g.getSeriesById("s1"); series.setValueByCategoryId("c5", (r / 2) * (Math.sin(v) + 0)); g.updatePoint("s1", "c5"); v += 2 * Math.PI / 180; var p = g.getPointByIds("s1", "c5"); if (!p) { p = new BiChartPoint(g, "s1", "c5"); g.addPoint(p); } var c = Math.round(255 * Math.sin(v)); p.setFillColor("rgb(" + c + "," + c + "," + c + ")"); }); t.start(); ///// End Animation /////}Graph2Test.main = function () { new Graph2Test; };function getFunctionText( f ){ var s = String(f).replace( /Math\./g, ""); var re = /return\s+([^;}]+)/m; re.exec( s ); return RegExp.$1;} ]]></Script> </Resources></Application>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -