package chartdirecttest;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import ChartDirector.*;
//implements DemoModule
public class simplepie
{
//Name of demo program窗口title
public String toString() { return "Simple Pie Chart"; }
//Number of charts produced in this demo图标个数设置
public int getNoOfCharts() { return 1; }
//Main code for creating charts产生一个图表视图
public void createChart(ChartViewer viewer, int index)
{
// The data for the pie chart图表数据
double[] data = {25, 18, 15, 12, 8, 30, 35};
// The labels for the pie chart图表各项名字
String[] labels = {"Labor", "Licenses", "Taxes", "Legal", "Insurance",
"Facilities", "Production"};
// Create a PieChart object of size 360 x 300 pixels视图的宽和长
PieChart c = new PieChart(360, 300);
// Set the center of the pie at (180, 140) and the radius to 100 pixels图形的坐标(从图形中心定位),半径
c.setPieSize(180, 140, 100);
// Set the pie data and the pie labels把数据项以及对应的数据添加到图表上
c.setData(data, labels);
// Output the chart把图表转换成图像然后放到视图上去
viewer.setImage(c.makeImage());
//include tool tip for the chart提示(目前表示没看懂这部分代码)
viewer.setImageMap(c.getHTMLImageMap("clickable", "",
"title='{label}: US${value}K ({percent}%)'"));
}
//Allow this module to run as standalone program for easy testing测试的main函数
public static void main(String[] args)
{
//Instantiate an instance of this demo module
simplepie demo = new simplepie();// DemoModule
//Create and set up the main window
JFrame frame = new JFrame(demo.toString());
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {System.exit(0);} });
frame.getContentPane().setBackground(Color.white);
// Create the chart and put them in the content pane
ChartViewer viewer = new ChartViewer();
demo.createChart(viewer, 0);
frame.getContentPane().add(viewer);
// Display the window
frame.pack();
frame.setVisible(true);
}
}
分享到:
相关推荐
ChartDirector 官方war包 ChartDirector 官方war包 ChartDirector 官方war包 ChartDirector 官方war包 ChartDirector 官方war包 ChartDirector 官方war包
ChartDirector开发文档和例子,里面有一个war包例子 解压后部署直接访问即可,个人觉得比Jfreechart好用
chartDirector官方资源(含文档,jar包,Demo等)
摘取常用的ChartDirector图形例子,可以参考下
ChartDirector 5.1 C++ Crack
ChartDirector画图测试
ChartDirector java下简单易用 破解方便
ChartDirector 图形报表ChartDirector 图形报表ChartDirector 图形报表ChartDirector 图形报表ChartDirector 图形报表
chartdirector for C++ 64位。
chartdirector_csharp chartdirector_csharp chartdirector_csharp chartdirector_csharp chartdirector_csharp c#专业做图库 相当强大
chartdirector 5.1 for .NET
ChartDirector 是一款商业的图表库,有多种语言的版本,使用它做的图表非常的精细漂亮,这是最新的6.0版包含了32位和64位两种版本
chartdirector for c++ 破解 去除未注册版底下黄色未注册信息条
ChartDirector 5.1 C++ 破解 Crack
ChartDirector是一款实用的商业图表工具,拥有丰富的图表图形组件库。
ChartDirector is available in the following programming languages and component technologies. ASP / COM / Visual Basic / VBScript / JScript .NET (C#, VB.NET, Managed C++, JScript.NET) Java PHP ...