精彩专题推荐:建站之入门课 建站之必修课 建站之关键课 网站价值所在 流量提高专题 css+div 标准 个人网站打造全过程
返回建站学首页
导航:
建站首页 | 网站设计 | 网站开发 | 网站运营 | 网页软件 | 建站指南 | 搜索优化 | 图像处理 | 视频教程 | 书籍教程 | 建站专题
当前位置:首页>网站开发>ajax教程>正文

ajax开发工具bindows使用指南:使用图表


来源: 时间:07-01-01 点击: 点击这里收藏本文

   var splitPane = new BiSplitPane("horizontal", leftPane, graph);
 
   graph.setBorder( new BiBorder(2, "inset") );
   graph.setBackColor("#cfe0f2");
 
   win.add(splitPane);
   splitPane.setLocation(3, 3);
   splitPane.setRight(3);
   splitPane.setBottom(3);
 
   // we can now call update because the graph has been added to the window
   graph.update();
 
   // Left Pane
   // ...
}事件处理
图表有几个特别的鼠标事件,当用户点击(或其它鼠标事件)结点。一个结点就是在图表中数据的可视化表示。当图表的类型是 column 或者 bar 时,结点就是矩形。当类型是 line 时,节点就是线标记。

在下面的应用程序中我们会监听 pointclick 事件,当节点被点击,我们就会获取数据的信息,将它插入到左边面板的文本框。

graph.addEventListener("pointclick", function (e) {
   // store info for later use
   currentSeries = e.getSeries();
   currentCategory = e.getCategory();
   // update fields
   valueField.setValue( e.getSeries().getValueByCategory(e.getCategory()) );
   seriesField.setText( e.getSeries().getTitle() );
   categoryField.setText( e.getCategory().getTitle() );
   valueField.setEnabled(true);
});更新图表
当节点的数值改变,我们需要图表中节点的也被正确的更新。这要通过调用 updatePoint。

// when changing the value update the point value and update the graph
valueField.addEventListener("change", function (e) {
   if (currentSeries && currentCategory) {
      currentSeries.setValueByCategory(currentCategory, valueField.getValue());
      graph.updatePoint(currentSeries.getId(), currentCategory.getId());
   }
});如果没有这么做视图就不会反映出模型的信息,这会引起混乱。

改变图标类型
前面提到图表组件支持几种不同的图表类型。在这个应用程序中我们允许用户通过组合框改变图表类型。当组合框改变时,我们改变图表的 chartType。改变完类型我们需要调用 update 方法更新视图。

chartTypeCombo.addEventListener("change", function (e) {
   graph.setChartType(chartTypeCombo.getSelectedItem().getText());
   graph.update();
});

9 7 3 1 2 3 4 8 :

  把此文章收藏到:          
广而告之
文章搜索
  • Google JZxue.Com

关于我们 | 联系我们 | 友情链接 | 网站地图
Copyright © 2005 - 2006 建站学 All rights reserved.