bl双性强迫侵犯h_国产在线观看人成激情视频_蜜芽188_被诱拐的少孩全彩啪啪漫画

java繪制折線代碼 Java畫折線圖

java 中如何繪制90度折線?

90度直角彎線其實就是兩條直線,第一條線的兩個頂點坐標其實你是知道的,然后第二條線的第一個頂點就是你第一條線的第二個頂點,第二條線的第二個頂點可以根據第一個頂點跟長度計算出來。

10年積累的成都網站設計、成都網站建設經驗,可以快速應對客戶對網站的新想法和需求。提供各種問題對應的解決方案。讓選擇我們的客戶得到更好、更有力的網絡服務。我雖然不認識你,你也不認識我。但先網站制作后付款的網站建設流程,更有泉州免費網站建設讓你可以放心的選擇與我們合作。

如何在netbeans6.8中用Java語言繪制類型于下圖的折線圖,要有詳細代碼

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???????????????????

}

如何用java 畫折線圖

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;

}

}

網友分享,看看是否能幫到你

java中用jframechart如何實現柱狀折線組合圖,請教高手,最好有個例子給我看看,謝謝!!

是jFreeChart吧?

這是Struts中結合 jFreeChart 畫3種圖,是我自己一個項目用到的 你自己看看吧 其中為生成List數據 我是在數據庫用取出來的 jFreeChart 的接受數據應該是 類似于二維數組型的 這個網上有介紹

public String chartDB() {

if (style.equals("餅圖")) {

drawPieChart();

} else if (style.equals("垂直柱狀統計圖")) {

drawBarChart();

} else if (style.equals("折線統計圖")) {

drawLineChart();

}

return SUCCESS;

}

private void drawLineChart() {

MapString, Object session = ActionContext.getContext().getSession();

recordids = (String[]) session.get("recordids");

String[] field = new String[word.length]; // 獲得要查詢的字段

String[] rowKeys = new String[word.length]; // 各字段的中文名稱

for (int i = 0; i word.length; i++) {

field[i] = word[i].split("-")[0];

rowKeys[i] = word[i].split("-")[1];

}

StringBuffer sb = new StringBuffer("SELECT ");

for (int j = 0; j field.length; j++) {

sb.append("sum(" + field[j] + "), ");

}

sb

.append("DATE_FORMAT(bas_datestart,'%Y-%m') from disasterrecord where bas_recordid in "

+ Util.typesToString(recordids)

+ " group by DATE_FORMAT(bas_datestart,'%Y-%m')");

ListObject[] list = new SearchService().findBySql(sb.toString());

DefaultCategoryDataset dataSet = new DefaultCategoryDataset();

String[] category = new String[list.size()];

for (int k = 0; k field.length; k++) {

for (int j = 0; j list.size(); j++) {

if(list.get(j)[field.length]==null){

category[j] = "";

}else{

category[j] = list.get(j)[field.length].toString();

}

if(list.get(j)[k] ==null){

dataSet.addValue(new Double(0), rowKeys[k], category[j]);

}else{

dataSet.addValue(new Double(list.get(j)[k].toString()),

rowKeys[k], category[j]);

}

}

}

chart = ChartFactory.createLineChart(title, xname, yname, dataSet,

PlotOrientation.VERTICAL, true, true, false);

chart.getTitle().setFont(new Font("宋體", Font.BOLD, 15));

chart.getLegend().setItemFont(new Font("黑體", Font.BOLD, 15));

CategoryPlot plot = (CategoryPlot) chart.getPlot();

CategoryAxis domainAxis = plot.getDomainAxis();

/*------設置X軸坐標上的文字-----------*/

domainAxis.setTickLabelFont(new Font("黑體", Font.PLAIN, 11));

/*------設置X軸的標題文字------------*/

domainAxis.setLabelFont(new Font("宋體", Font.PLAIN, 12));

NumberAxis numberaxis = (NumberAxis) plot.getRangeAxis();

/*------設置Y軸坐標上的文字-----------*/

numberaxis.setTickLabelFont(new Font("黑體", Font.PLAIN, 12));

/*------設置Y軸的標題文字------------*/

numberaxis.setLabelFont(new Font("黑體", Font.PLAIN, 12));

}

private void drawBarChart() {

MapString, Object session = ActionContext.getContext().getSession();

recordids = (String[]) session.get("recordids");

String[] field = new String[word.length]; // 獲得要查詢的字段

String[] rowKeys = new String[word.length]; // 各字段的中文名稱

for (int i = 0; i word.length; i++) {

field[i] = word[i].split("-")[0];

rowKeys[i] = word[i].split("-")[1];

}

StringBuffer sb = new StringBuffer("SELECT ");

if (type.equals("各地區各災害")) {

for (int j = 0; j field.length; j++) {

sb.append("sum(" + field[j] + "), ");

}

sb

.append(" bas_cityarea from disasterrecord where bas_recordid in "

+ Util.typesToString(recordids)

+ " group by bas_cityarea");

} else {

for (int j = 0; j field.length; j++) {

sb.append("sum(" + field[j] + "), ");

}

sb

.append("Year(bas_datestart) from disasterrecord where bas_recordid in "

+ Util.typesToString(recordids)

+ " group by Year(bas_datestart)");

}

ListObject[] list = new SearchService().findBySql(sb.toString());

String[] columnKeys = new String[list.size()]; // 獲得 各地區名 或者 年份

for (int k = 0; k list.size(); k++) {

columnKeys[k] = list.get(k)[field.length].toString();

}

double[][] data = new double[rowKeys.length][columnKeys.length];

for (int m = 0; m rowKeys.length; m++) {

for (int n = 0; n columnKeys.length; n++) {

if (list.get(n)[m] == null) {

data[m][n] = new Double(0);

} else {

data[m][n] = new Double(list.get(n)[m].toString());

}

}

}

CategoryDataset dataset = DatasetUtilities.createCategoryDataset(

rowKeys, columnKeys, data);

chart = ChartFactory.createBarChart3D(title, xname, yname, dataset,

PlotOrientation.VERTICAL, true, true, false);

CategoryPlot plot = chart.getCategoryPlot();// 獲取圖表區域對象

CategoryAxis domainAxis = plot.getDomainAxis();

// 水平底部列表

domainAxis.setLabelFont(new Font("黑體", Font.BOLD, 14));

// 水平底部標題

domainAxis.setTickLabelFont(new Font("宋體", Font.BOLD, 12));

// 垂直標題

ValueAxis rangeAxis = plot.getRangeAxis();// 獲取柱狀

rangeAxis.setLabelFont(new Font("黑體", Font.BOLD, 15));

TextTitle textTitle = chart.getTitle();

textTitle.setFont(new Font("黑體", Font.BOLD, 15));

BarRenderer3D renderer = new BarRenderer3D();

renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());

renderer.setBaseItemLabelsVisible(true);

renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT));

renderer.setItemLabelAnchorOffset(10D);

renderer.setItemLabelFont(new Font("宋體", Font.PLAIN, 12));

renderer.setItemLabelsVisible(true);

//設置每個地區所包含的平行柱的之間距離

//renderer.setItemMargin(0.3);

plot.setRenderer(renderer);

chart.getLegend().setItemFont(new Font("黑體", Font.BOLD, 15));

}

public void drawPieChart() {

MapString, Object session = ActionContext.getContext().getSession();

recordids = (String[]) session.get("recordids");

String sql = "";

String field[] = word[0].split("-");

if (type.equals("各地區各災害")) {

sql = "SELECT sum("

+ field[0]

+ ") +'', bas_cityarea from disasterrecord where bas_recordid in "

+ Util.typesToString(recordids) + " group by bas_cityarea";

} else {

sql = "SELECT sum("

+ field[0]

+ ") +'', Year(bas_datestart) from disasterrecord where bas_recordid in "

+ Util.typesToString(recordids)

+ " group by Year(bas_datestart)";

}

ListObject[] list = new SearchService().findBySql(sql);

DefaultPieDataset data = new DefaultPieDataset();

for (Object[] o : list) {

if(o[0] == null){

data.setValue(o[1].toString(), new Double(0));

}

data.setValue(o[1].toString(), new Double(o[0].toString()));

}

chart = ChartFactory.createPieChart(title, data, true, true, false);

Font font = new Font("SimSun", 10, 20);

TextTitle txtTitle = null;

txtTitle = chart.getTitle();

txtTitle.setFont(font);

PiePlot pieplot = (PiePlot)chart.getPlot();

pieplot.setLabelFont(font);

chart.getLegend().setItemFont(font);

}

Java開發jfreechart的折線圖時,想要實現鼠標移向每個折點時只顯示Y軸對應的數值,應該怎么做?

jfreechart只能產生靜態圖表,鼠標移上去顯示的數值,實際上是靠html 的map來實現的,因此那個矩形框是瀏覽器顯示的,與代碼無關,所以也改不了的。

至于只顯示Y軸的值,請從chart得到plot,然后再從plot得到renderer,再自定義renderer的ToolTipGenerator,從而實現自定義的tooltip.

如果想要更動態的圖表,可以使用flash圖表,如fusioncharts

java折線圖數據庫

用這個插件可以實現,只需要將你從數據庫中得到的數據封裝成xml格式的數據,就可以在頁面上顯示,顯示的效果就像excel中的統計圖,如果需要我可以給你發一下這個插件FusionChartsFree

網站題目:java繪制折線代碼 Java畫折線圖
本文路徑:http://vcdvsql.cn/article22/dosddcc.html

成都網站建設公司_創新互聯,為您提供網站策劃網站改版企業建站虛擬主機定制網站云服務器

廣告

聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯

成都定制網站網頁設計