📄 charttest5.xml
字号:
<?xml version="1.0"?><Application> <Window caption="Chart Test" width="500" height="400" centered="true"/> <Resources> <Package name="Charting"/> <Script><![CDATA[function ChartTest5() { var win = application.getWindow(); var cb = new BiComboBox(["line", "column", "stackedcolumn", "percentagestackedcolumn", "bar", "stackedbar", "percentagestackedbar", "pie"]); win.add(cb); cb.setLocation(10, 10); cb.setWidth(150); var d0 = new Date; var graph = BiGraph.fromUri("ronchart.xml"); win.add(graph); graph.update(); graph.setLocation(10, cb.getHeight() + 20); graph.setRight(10); graph.setBottom(10); graph.setBorder( new BiBorder(1, "solid", "black") ); graph.setBackColor("#cfe0f2"); win.setCaption(win.getCaption() + " [" + (new Date - d0) + "ms]"); cb.findString(graph.getChartType()).setSelected(true); cb.addEventListener("change", function (e) { var s = win.getCaption(); var d0 = new Date; graph.setChartType(cb.getSelectedItem().getText()); graph.update(); var t = new Date - d0; win.setCaption( s.replace(/\[.+\]/, "[" + t + "]") ); }, this); // context menu var cm = new BiMenu; var cmi = []; for (var i = 0; i < 3; i++) { cmi[i] = new BiMenuItem; cm.add(cmi[i]); } graph.getContextMenuForPoint = function (oSeries, oCategory) { cmi[0].setText("Series \"" + oSeries.getTitle() + "\""); cmi[1].setText("Category \"" + oCategory.getTitle() + "\""); cmi[2].setText("Value: " + oSeries.getValueByCategoryId(oCategory.getId()) ); return cm; }; // tool tip var tt = new BiToolTip; tt.setHideInterval(10 * 1000); tt.setPaddingLeft(20); var ttIcon = new BiComponent; ttIcon.setLocation(0,0); ttIcon.setBottom(0); ttIcon.setWidth(14); b = new BiBorder; b.setRight(1, "solid", "InfoText"); ttIcon.setBorder(b); tt.add(ttIcon); graph.getToolTipForPoint = function (oSeries, oCategory) { var pm = graph.getPresentationManager(); var fillColor = pm.getFillColorForPoint(oSeries.getId(), oCategory.getId()); var strokeColor = pm.getStrokeColorForPoint(oSeries.getId(), oCategory.getId()); ttIcon.setBackColor( fillColor ); tt.setHtml("Series: <b>" + oSeries.getTitle() +"</b><br>" + "Category: <b>" + oCategory.getTitle() + "</b><br>" + "Value: <b>" + oSeries.getValueByCategoryId(oCategory.getId()) + "</b>"); return tt; };}ChartTest5.main = function () { new ChartTest5; }; ]]></Script> </Resources></Application>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -