你可以试试chrome加birt。其实jvm内存是有限的,几百万个点很快就吃光你的内存了。
为新抚等地区用户提供了全套网页设计制作服务,及新抚网站建设行业解决方案。主营业务为网站设计制作、成都网站制作、新抚网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!
如果你用birt虽然后台画的时候慢一点,但是结果就是一个网页展示jpg图片,所以前端用户那里应该还是比较快的。
package com.lei.jfreechart;
import javax.swing.JPanel;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.ui.ApplicationFrame;
import org.jfree.ui.RefineryUtilities;
public class LineCharts extends ApplicationFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
public LineCharts(String s) {
super(s);
setContentPane(createDemoLine());
}
public static void main(String[] args) {
LineCharts fjc = new LineCharts("折线图");
fjc.pack();
RefineryUtilities.centerFrameOnScreen(fjc);
fjc.setVisible(true);
}
// 生成显示图表的面板
public static JPanel createDemoLine() {
JFreeChart jfreechart = createChart(createDataset());
return new ChartPanel(jfreechart);
}
// 生成图表主对象JFreeChart
public static JFreeChart createChart(DefaultCategoryDataset linedataset) {
// 定义图表对象
JFreeChart chart = ChartFactory.createLineChart("一季度销售曲线", //折线图名称
"时间", // 横坐标名称
"销售额(百万)", // 纵坐标名称
linedataset, // 数据
PlotOrientation.VERTICAL, // 水平显示图像
true, // include legend
true, // tooltips
false // urls
);
CategoryPlot plot = chart.getCategoryPlot();
plot.setRangeGridlinesVisible(true); //是否显示格子线
plot.setBackgroundAlpha(0.3f); //设置背景透明度
NumberAxis rangeAxis = (NumberAxis)plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
rangeAxis.setAutoRangeIncludesZero(true);
rangeAxis.setUpperMargin(0.20);
rangeAxis.setLabelAngle(Math.PI / 2.0);
return chart;
}
// 生成数据
public static DefaultCategoryDataset createDataset() {
DefaultCategoryDataset linedataset = new DefaultCategoryDataset();
// 各曲线名称
String series1 = "冰箱";
String series2 = "彩电";
String series3 = "洗衣机";
// 横轴名称(列名称)
String type1 = "1月";
String type2 = "2月";
String type3 = "3月";
linedataset.addValue(0.0, series1, type1);
linedataset.addValue(4.2, series1, type2);
linedataset.addValue(3.9, series1, type3);
linedataset.addValue(1.0, series2, type1);
linedataset.addValue(5.2, series2, type2);
linedataset.addValue(7.9, series2, type3);
linedataset.addValue(2.0, series3, type1);
linedataset.addValue(9.2, series3, type2);
linedataset.addValue(8.9, series3, type3);
return linedataset;
}
}
网友分享,看看是否能帮到你
public class XYJFrame extends javax.swing.JFrame {
/**
* Creates new form XYJFrame
*/
public XYJFrame() {
initComponents();
iniCoordinate();
}
/**
* Netbeans 生成的代码,用于界面设计
*/
@SuppressWarnings("unchecked")
// editor-fold defaultstate="collapsed" desc="Generated Code"
private void initComponents() {
lblXCoordinate = new javax.swing.JLabel();
lblYCoordinate = new javax.swing.JLabel();
txtXCoordinate = new javax.swing.JTextField();
txtYCoordinate = new javax.swing.JTextField();
btnCalculateY = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
lblXCoordinate.setText("X 坐标");
lblYCoordinate.setText("Y 坐标");
btnCalculateY.setText("计算 Y 坐标");
btnCalculateY.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCalculateYActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(37, 37, 37)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblXCoordinate)
.addComponent(lblYCoordinate))
.addGap(29, 29, 29)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txtXCoordinate)
.addComponent(txtYCoordinate, javax.swing.GroupLayout.DEFAULT_SIZE, 165, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(btnCalculateY)
.addGap(30, 30, 30)))
.addContainerGap(131, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(70, 70, 70)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblXCoordinate)
.addComponent(txtXCoordinate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(24, 24, 24)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblYCoordinate)
.addComponent(txtYCoordinate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(28, 28, 28)
.addComponent(btnCalculateY)
.addContainerGap(103, Short.MAX_VALUE))
);
pack();
}// /editor-fold
private void btnCalculateYActionPerformed(java.awt.event.ActionEvent evt) {
this.txtYCoordinate.setText(this.calculateY() + "");
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(XYJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(XYJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(XYJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(XYJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
///editor-fold
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new XYJFrame().setVisible(true);
}
});
}
private void iniCoordinate() {
// 转折点 X 坐标
dbXCoordinate = new double[] { 0, 0.1, 0.3, 0.5, 1 };
// 转折点 Y 坐标
dbYCoordinate = new double[] { 0, 0.4, 0.7, 0.85, 1 };
}
// 计算 Y 坐标
private double calculateY() {
double xCoordinate = Double.parseDouble(this.txtXCoordinate.getText());
int xPos = getXPositon(xCoordinate);
return xPos == -1 ? -1 : (dbYCoordinate[xPos] * xCoordinate) / dbXCoordinate[xPos];
}
// 得到输入的 X 值位置,确定比率
private int getXPositon(double xCoordinate) {
for(int i=0; i dbXCoordinate.length; i++) {
if(xCoordinate = dbXCoordinate[i]) {
return i;
}
}
return -1;
}
private double[] dbXCoordinate = new double[5];
private double[] dbYCoordinate = new double[5];
private double[] rate = new double[5];
// Variables declaration - do not modify
private javax.swing.JButton btnCalculateY;
private javax.swing.JLabel lblXCoordinate;
private javax.swing.JLabel lblYCoordinate;
private javax.swing.JTextField txtXCoordinate;
private javax.swing.JTextField txtYCoordinate;
// End of variables declaration
}
1、自己编写java程序,也就几十行代码,先访问数据库取数,再封装数据.
2、很多啊,eclipse,myeclipse,jbuilder。。。
3、getconnection()
String DBDriver = SysConfig.getProperty("database.defaultProvider.driver");
String DBUser = SysConfig.getProperty("database.defaultProvider.username");
String DBPassword = SysConfig.getProperty("database.defaultProvider.password");
String DBUrl = SysConfig.getProperty("database.defaultProvider.serverURL");
//
Class.forName(DBDriver);
Properties myprop = System.getProperties();
myprop.setProperty("user",DBUser);
myprop.setProperty("password",DBPassword);
conn = DriverManager.getConnection(DBUrl,myprop);
..........
PreparedStatement pstmt = conn.prepareStatement(query);
ResultSet rs = pstmt.executeQuery();
.......
4.下载jfreechart的jar包,调用里面的方法,参考它的api,就是一步一步的多试验下
自由配置图表。操作java折线图代码,可以自由配置图表的各个属性,用来达到自己的要求和目的。Java是一门面向对象的编程语言,不仅吸收了C++语言的各种优点,还摒弃了C++里难以理解的多继承、指针等概念,因此Java语言具有功能强大和简单易用两个特征。