LayoutInflater用处很大,具体参考http://weizhulin.blog.51cto.com/1556324/311450
http://blog.csdn.net/hongshan50/article/details/6585396
这里有一份很好的文章:
[url]http://www.cnblogs.com/feisky/archive/2010/01/16/1649081.html
[/url]
1.无参数Activity跳转
Intent it = new Intent(Activity.Main.this, Activity2.class); startActivity(it);
2.向下一个Activity传递数据(使用Bundle和Intent.putExtras)
Intent it = new Intent(Activity.Main.this, Activity2.class);
Bundle bundle=new Bundle(); bundle.putString("name", "This is from MainActivity!"); it.putExtras(bundle); // it.putExtra(“test”, "shuju”); startActivity(it); // startActivityForResult(it,REQUEST_CODE);
对于数据的获取可以采用:
Bundle bundle=getIntent().getExtras(); String name=bundle.getString("name");
3.向上一个Activity返回结果(使用setResult,针对
startActivityForResult(it,REQUEST_CODE)启动的Activity) Intent intent=getIntent(); Bundle bundle2=new Bundle(); bundle2.putString("name", "This is from ShowMsg!"); intent.putExtras(bundle2); setResult(RESULT_OK, intent);
4.回调上一个Activity的结果处理函数(onActivityResult)
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub super.onActivityResult(requestCode, resultCode, data); if (requestCode==REQUEST_CODE){ if(resultCode==RESULT_CANCELED) setTitle("cancle"); else if (resultCode==RESULT_OK) { String temp=null; Bundle bundle=data.getExtras(); if(bundle!=null) temp=bundle.getString("name"); setTitle(temp); } } }
我的例子源码:
main.xml
----------------------------------------------
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <EditText android:id="@+id/factorone" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <TextView android:id="@+id/symbol" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/symbol" /> <EditText android:id="@+id/factortwo" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <Button android:id="@+id/calculate" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/calculate" /> </LinearLayout>
result.xml
----------------------------------------------
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:id="@+id/totalRsult" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/symbol" /> </LinearLayout>
strings.xml
----------------------------------------------
<?xml version="1.0" encoding="utf-8"?> <resources> <string name="hello">Hello World, Android_TwoActivityActivity!</string> <string name="app_name">Android_TwoActivity</string> <string name="firstActivity">第一个Activity</string> <string name="secondActivity">第二个Activity</string> <string name="symbol">乘以</string> <string name="calculate">计算</string> </resources>
FirstActivity.java
----------------------------------------------
package com.pandy.test; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class FirstActivity extends Activity { private EditText factorOne; private EditText factorTwo; private TextView symbol; private Button calculate; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); factorOne = (EditText) findViewById(R.id.factorone); factorTwo = (EditText) findViewById(R.id.factortwo); symbol = (TextView) findViewById(R.id.symbol); calculate = (Button) findViewById(R.id.calculate); calculate.setOnClickListener(new MyListener()); } class MyListener implements OnClickListener { @Override public void onClick(View arg0) { Intent intent = new Intent(); intent.setClass(FirstActivity.this, SecondActivity.class); intent.putExtra("factorOneStr", factorOne.getText().toString()); intent.putExtra("factorTwoStr", factorTwo.getText().toString()); startActivity(intent); } } }
SecondActivity.java
----------------------------------------------
package com.pandy.test; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.widget.TextView; public class SecondActivity extends Activity { private TextView resultView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.result); resultView = (TextView) findViewById(R.id.totalRsult); Intent intent = getIntent(); String factorOneStr = intent.getStringExtra("factorOneStr"); String factorTwoStr = intent.getStringExtra("factorTwoStr"); int factorOneInt = Integer.parseInt(factorOneStr); int factorTwoInt = Integer.parseInt(factorTwoStr); resultView.setText(factorOneInt * factorTwoInt + ""); } }
R.java
----------------------------------------------
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.pandy.test; public final class R { public static final class attr { } public static final class drawable { public static final int ic_launcher=0x7f020000; } public static final class id { public static final int calculate=0x7f050003; public static final int factorone=0x7f050000; public static final int factortwo=0x7f050002; public static final int symbol=0x7f050001; public static final int totalRsult=0x7f050004; } public static final class layout { public static final int main=0x7f030000; public static final int result=0x7f030001; } public static final class string { public static final int app_name=0x7f040001; public static final int calculate=0x7f040005; public static final int firstActivity=0x7f040002; public static final int hello=0x7f040000; public static final int secondActivity=0x7f040003; public static final int symbol=0x7f040004; } }
AndroidManifest.xml
----------------------------------------------
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.pandy.test" android:versionCode="1" android:versionName="1.0" > <application android:label="@string/app_name" > <activity android:name=".FirstActivity" android:label="@string/firstActivity" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".SecondActivity" android:label="@string/secondActivity" /> </application> <uses-sdk android:minSdkVersion="4" /> </manifest>
一、JFreeChart获取。
1、JFreeReport:报表解决工具
2、JFreeChart:Java图形(Application/Applet/Servlet/Jsp)
3、JCommon:JFreeReport和JFreeChart的公共类库
4、JFreeDesigner:JFreeReport的报表设计工具
我们可以从jfree官方网站上获取最新版本和相关资料(但是jfree的document需要40美金才能获取),
获取地址:http://www.jfree.org/jfreechart/index.html (同时可以获得简明介绍)
我们以当前最新版本:jfreechart_0.9.21.zip为例子进行说明。
二、JFreeChart配置安装
1、解压jfreechart_0.9.21.zip到指定位置,其中source是jfreechart的源码,jfreechart-0.9.21-demo.jar
是例子程序(该部分留给大家自己去研究)
2、为了配置成功,我们需要关注的文件有如下三个:jfreechart-0.9.21.jar、lib\jcommon-0.9.6.jar、
lib\gnujaxp.jar
3、如果是Application开发,把上述三个文件拷贝到%JAVA_HOME%\LIB中,同时在环境变量CLASSPATH中加入
如果是WEB开发,以TOMCAT中的一个WEB项目TEST为例子说明:
把上述三个文件拷贝到TEST\WEB-INF\LIB中,然后修改TEST\WEB-INF\web.xml文件,在其中加入如下代码:
DisplayChart
org.jfree.chart.servlet.DisplayChart
DisplayChart
/servlet/DisplayChart
至此jfreechart的配置就完成了,下面就可以进行jfreechart的开发了。这里值得提出的是jfreechart的类
结构设计前后兼容性不是很好,不同版本的jfreechart中类库结构可能不一样,有时候可能需要查源码。如果
是中文显示的时候可能依据观感需要改变源码的字体,不过我个人觉得这个版本比以前版本要好一些。
三、JFreeChart功能介绍
JFreeChart目前是最好的java图形,基本能够解决目前的图形方面的需求,主要包括如下几个方面:
pie charts (2D and 3D):饼图(平面和立体)
bar charts (regular and stacked, with an optional 3D effect):柱状图
line and area charts:曲线图
scatter plots and bubble charts
time series, high/low/open/close charts and candle stick charts:时序图
combination charts:复合图
Pareto charts
Gantt charts:甘特图
wind plots, meter charts and symbol charts
wafer map charts
(态图表,饼图(二维和三维) , 柱状图 (水平,垂直),线图,点图,时间变化图,甘特图, 股票行情图,混和图, 温度计图, 刻度图等常用商用图表)
图形可以导出成PNG和JPEG格式,同时还可以与PDF和EXCEL关联
JFreeChart核心类库介绍:
研究jfreechart源码发现源码的主要由两个大的包组成:org.jfree.chart,org.jfree.data。其中前者主要与图形
本身有关,后者与图形显示的数据有关。具体研究如果大家有兴趣的话可以自己研究,以后有时间我会告诉大家怎么去
研究源码。
核心类主要有:
org.jfree.chart.JFreeChart:图表对象,任何类型的图表的最终表现形式都是在该对象进行一些属性的定制。JFreeChart引擎本身提供了一个工厂类用于创建不同类型的图表对象
org.jfree.data.category.XXXDataSet:数据集对象,用于提供显示图表所用的数据。根据不同类型的图表对应着很多类型的数据集对象类
org.jfree.chart.plot.XXXPlot:图表区域对象,基本上这个对象决定着什么样式的图表,创建该对象的时候需要Axis、Renderer以及数据集对象的支持
org.jfree.chart.axis.XXXAxis:用于处理图表的两个轴:纵轴和横轴
org.jfree.chart.render.XXXRender:负责如何显示一个图表对象
org.jfree.chart.urls.XXXURLGenerator:用于生成Web图表中每个项目的鼠标点击链接
XXXXXToolTipGenerator:用于生成图象的帮助提示,不同类型图表对应不同类型的工具提示类
四、jFreeChart产生图形的流程
创建一个数据源(dataset)来包含将要在图形中显示的数据
创建一个 JFreeChart 对象来代表要显示的图形
把图形输出
重要的类和接口:
org.jfree.data.general.Dataset 所有数据源类都要实现的接口
org.jfree.chart.ChartFactory 由它来产生 JFreeChart 对象
org.jfree.chart.JFreeChart 所有对图形的调整都是通过它噢!!
org.jfree.chart.plot.Plot 通过JFreeChart
对象获得它,然后再通过它对图形外部部分(例:坐标轴)调整
注意:它有很多子类,一般都下嗍造型到它的子类!
org.jfree.chart.renderer.AbstractRenderer 通过JFreeChart
对象获得它,然后再通过它对图形内部部分
(例:折线的类型)调整。同样,针对不同类型的报表图,它有
着不同的子类实现!在下面我们简称它为 Renderer
下面我们结合不同类型的图形来具体分析这个流程。
五、饼图
饼图的dataset 一般是用PieDataset 接口,具体实现类是 DefaultPieDataset
1、创建一个数据源(dataset):
private static PieDataset createDataset()
{
DefaultPieDataset defaultpiedataset = new DefaultPieDataset();
//注意是DefaultPieDataset!!
defaultpiedataset.setValue(”One”, new
Double(43.200000000000003D));
defaultpiedataset.setValue(”Two”, new Double(10D));
defaultpiedataset.setValue(”Three”, new Double(27.5D));
defaultpiedataset.setValue(”Four”, new Double(17.5D));
return defaultpiedataset;
}
2、由ChartFactory 产生 JFreeChart 对象
private static JFreeChart createChart(PieDataset piedataset)
{
JFreeChart jfreechart = ChartFactory.createPieChart(”Pie Chart Demo
1″, //图形标题名称
piedataset, // dataset
true, // legend?
true, // tooltips?
false); //URLs?
PiePlot pieplot = (PiePlot)jfreechart.getPlot(); //通过JFreeChart
对象获得 plot:PiePlot!!
pieplot.setNoDataMessage(”No data available”); //
没有数据的时候显示的内容
return jfreechart;
}
一些重要的方法:
pieplot.setExplodePercent(0,0.3D) //把Lable 为”One”
的那一块”挖”出来30%
3、输出略
六、柱状图
柱状图的dataset 一般是用CatagoryDataset接口(具体实现类是DefaultCategoryDataset),也会用
IntervalXYDataset
接口
1、创建一个数据源(dataset):
private static CategoryDataset createDataset()
{
String series1 = “First”;
String series2 = “Second”;
String series3 = “Third”;
String category1 = “Category 1″;
String category2 = “Category 2″;
String category3 = “Category 3″;
String category4 = “Category 4″;
String category5 = “Category 5″;
DefaultCategoryDataset defaultcategorydataset = new
DefaultCategoryDataset();
defaultcategorydataset.addValue(1.0D, series1, category1);
defaultcategorydataset.addValue(4D, series1, category2);
defaultcategorydataset.addValue(3D, series1, category3);
defaultcategorydataset.addValue(5D, series1, category4);
defaultcategorydataset.addValue(5D, series1, category5);
defaultcategorydataset.addValue(5D, series2, category1);
defaultcategorydataset.addValue(7D, series2, category2);
defaultcategorydataset.addValue(6D, series2, category3);
defaultcategorydataset.addValue(8D, series2, category4);
defaultcategorydataset.addValue(4D, series2, category5);
defaultcategorydataset.addValue(4D, series3, category1);
defaultcategorydataset.addValue(3D, series3, category2);
defaultcategorydataset.addValue(2D, series3, category3);
defaultcategorydataset.addValue(3D, series3, category4);
defaultcategorydataset.addValue(6D, series3, category5);
return defaultcategorydataset;
}
2、由ChartFactory 产生 JFreeChart 对象
private static JFreeChart createChart(CategoryDataset
categorydataset)
{
JFreeChart jfreechart =
ChartFactory.createBarChart(
"Bar Chart Demo", //图形标题名称
"Category",//domain 轴
Lable这里先简单理解为横坐标Lable好了
"Value", //range 轴 Lable这里也先简单理解为纵坐标Lable好了
categorydataset, // dataset
PlotOrientation.VERTICAL, //垂直显示
true, // legend?
true,
// tooltips?
false);
//URLs?
jfreechart.setBackgroundPaint(Color.white);
//设定背景色为白色
CategoryPlot categoryplot = jfreechart.getCategoryPlot(); //获得
plot:CategoryPlot!!
categoryplot.setBackgroundPaint(Color.lightGray); //设定图表数据显示部分背景色
categoryplot.setDomainGridlinePaint(Color.white);
//横坐标网格线白色
categoryplot.setDomainGridlinesVisible(true); //可见
categoryplot.setRangeGridlinePaint(Color.white); //纵坐标网格线白色
//设置series1与category的显示位置;类似效果图http://www.chinabs.net/webimages/PieChart7.png
categoryplot.setDomainAxisLocation(AxisLocation.TOP_OR_RIGHT);
categoryplot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
//使纵坐标的最小单位格为整数
NumberAxis numberaxis =
(NumberAxis)categoryplot.getRangeAxis();
numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
BarRenderer barrenderer = (BarRenderer)categoryplot.getRenderer();
//获得renderer 注意这里是下嗍造型到BarRenderer!!
//显示每个柱的数值,并修改该数值的字体属性;类似效果图http://www.chinabs.net/webimages/PieChart6.png
barrenderer.setItemLabelGenerator(new
StandardCategoryItemLabelGenerator());
barrenderer.setItemLabelFont(new Font("黑体",Font.PLAIN,12));
barrenderer.setItemLabelsVisible(true);
barrenderer.setDrawBarOutline(false); //
Bar的外轮廓线不画
GradientPaint gradientpaint = new GradientPaint(0.0F, 0.0F,
Color.blue,0.0F, 0.0F, new Color(0, 0, 64)); //设定特定颜色
GradientPaint gradientpaint1 = new GradientPaint(0.0F, 0.0F,
Color.green,0.0F, 0.0F, new Color(0, 64, 0));
GradientPaint gradientpaint2 = new GradientPaint(0.0F, 0.0F,
Color.red,0.0F, 0.0F, new Color(64, 0, 0));
barrenderer.setSeriesPaint(0, gradientpaint); //给series1
Bar设定上面定义的颜色
barrenderer.setSeriesPaint(1, gradientpaint1); //给series2 Bar
设定上面定义的颜色
barrenderer.setSeriesPaint(2, gradientpaint2); //给series3 Bar
设定上面定义的颜色
CategoryAxis categoryaxis = categoryplot.getDomainAxis(); //横轴上的
Lable 45度倾斜
categoryaxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
return jfreechart;
}
一些重要的方法:(增加一块标记)
IntervalMarker intervalmarker = new IntervalMarker(4.5D,
7.5D);
intervalmarker.setLabel("Target Range");
intervalmarker.setLabelFont(new Font(”SansSerif”, 2, 11));
intervalmarker.setLabelAnchor(RectangleAnchor.LEFT);
intervalmarker.setLabelTextAnchor(TextAnchor.CENTER_LEFT);
intervalmarker.setPaint(new Color(222, 222, 255, 128));
categoryplot.addRangeMarker(intervalmarker,
Layer.BACKGROUND);
七、折线图
折线图的dataset
两种CatagoryDataset接口(具体实现类是DefaultCategoryDataset),XYDataset
接口
1、CatagoryDataset接口:
A、创建一个数据源(dataset):
private static CategoryDataset createDataset()
{
String series1 = “First”;
String series2 = “Second”;
String series3 = “Third”;
String type1 = “Type 1″;
String type2 = “Type 2″;
String type3 = “Type 3″;
String type4 = “Type 4″;
String type5 = “Type 5″;
String type6 = “Type 6″;
String type7 = “Type 7″;
String type8 = “Type 8″;
DefaultCategoryDataset defaultcategorydataset = new
DefaultCategoryDataset();
defaultcategorydataset.addValue(1.0D, series1, type1);
defaultcategorydataset.addValue(4D, series1, type2);
defaultcategorydataset.addValue(3D, series1, type3);
defaultcategorydataset.addValue(5D, series1, type4);
defaultcategorydataset.addValue(5D, series1, type5);
defaultcategorydataset.addValue(7D, series1, type6);
defaultcategorydataset.addValue(7D, series1, type7);
defaultcategorydataset.addValue(8D, series1, type8);
defaultcategorydataset.addValue(5D, series2, type1);
defaultcategorydataset.addValue(7D, series2, type2);
defaultcategorydataset.addValue(6D, series2, type3);
defaultcategorydataset.addValue(8D, series2, type4);
defaultcategorydataset.addValue(4D, series2, type5);
defaultcategorydataset.addValue(4D, series2, type6);
defaultcategorydataset.addValue(2D, series2, type7);
defaultcategorydataset.addValue(1.0D, series2, type8);
defaultcategorydataset.addValue(4D, series3, type1);
defaultcategorydataset.addValue(3D, series3, type2);
defaultcategorydataset.addValue(2D, series3, type3);
defaultcategorydataset.addValue(3D, series3, type4);
defaultcategorydataset.addValue(6D, series3, type5);
defaultcategorydataset.addValue(3D, series3, type6);
defaultcategorydataset.addValue(4D, series3, type7);
defaultcategorydataset.addValue(3D, series3, type8);
return defaultcategorydataset;
}
B、由ChartFactory 产生 JFreeChart 对象 (与上面重复的部分就不再注释)
private static JFreeChart createChart(CategoryDataset
categorydataset)
{
JFreeChart jfreechart = ChartFactory.createLineChart(”Line Chart
Demo 1″,
“Type”,
“Value”,
categorydataset,
PlotOrientation.VERTICAL,
true,
true,
false);
jfreechart.setBackgroundPaint(Color.white);
CategoryPlot categoryplot =
(CategoryPlot)jfreechart.getPlot();
categoryplot.setBackgroundPaint(Color.lightGray);
categoryplot.setRangeGridlinePaint(Color.white);
NumberAxis numberaxis =
(NumberAxis)categoryplot.getRangeAxis();
numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
numberaxis.setAutoRangeIncludesZero(true);
//获得renderer 注意这里是下嗍造型到lineandshaperenderer!!
LineAndShapeRenderer lineandshaperenderer =
(LineAndShapeRenderer)categoryplot.getRenderer();
lineandshaperenderer.setShapesVisible(true); //series
点(即数据点)可见
lineandshaperenderer.setSeriesStroke(0, new BasicStroke(2.0F, 1, 1,
1.0F, new float[] {
10F, 6F
}, 0.0F)); //定义series为”First”的(即series1)点之间的连线 ,这里是虚线,默认是直线
lineandshaperenderer.setSeriesStroke(1, new BasicStroke(2.0F, 1, 1,
1.0F, new float[] {
6F, 6F
}, 0.0F)); //定义series为”Second”的(即series2)点之间的连线
lineandshaperenderer.setSeriesStroke(2, new BasicStroke(2.0F, 1, 1,
1.0F, new float[] {
2.0F, 6F
}, 0.0F)); //定义series为”Third”的(即series3)点之间的连线
return jfreechart;
}
一些重要的方法:
lineandshaperenderer.setLineVisible(true) //series
点(即数据点)间有连线可见
2、XYDataset 接口:
A、创建一个数据源(dataset):
private static XYDataset createDataset()
{
XYSeries xyseries = new XYSeries(”First”); //先产生XYSeries 对象
xyseries.add(1.0D, 1.0D);
xyseries.add(2D, 4D);
xyseries.add(3D, 3D);
xyseries.add(4D, 5D);
xyseries.add(5D, 5D);
xyseries.add(6D, 7D);
xyseries.add(7D, 7D);
xyseries.add(8D, 8D);
XYSeries xyseries1 = new XYSeries(”Second”);
xyseries1.add(1.0D, 5D);
xyseries1.add(2D, 7D);
xyseries1.add(3D, 6D);
xyseries1.add(4D, 8D);
xyseries1.add(5D, 4D);
xyseries1.add(6D, 4D);
xyseries1.add(7D, 2D);
xyseries1.add(8D, 1.0D);
XYSeries xyseries2 = new XYSeries(”Third”);
xyseries2.add(3D, 4D);
xyseries2.add(4D, 3D);
xyseries2.add(5D, 2D);
xyseries2.add(6D, 3D);
xyseries2.add(7D, 6D);
xyseries2.add(8D, 3D);
xyseries2.add(9D, 4D);
xyseries2.add(10D, 3D);
XYSeriesCollection xyseriescollection = new XYSeriesCollection();
//再用XYSeriesCollection添加入XYSeries 对象
xyseriescollection.addSeries(xyseries);
xyseriescollection.addSeries(xyseries1);
xyseriescollection.addSeries(xyseries2);
return xyseriescollection;
}
B、由ChartFactory 产生 JFreeChart 对象
private static JFreeChart createChart(XYDataset xydataset)
{
JFreeChart jfreechart = ChartFactory.createXYLineChart(”Line Chart
Demo 2″,
“X”,
“Y”,
xydataset,
PlotOrientation.VERTICAL,
true,
true,
false);
jfreechart.setBackgroundPaint(Color.white);
XYPlot xyplot = (XYPlot)jfreechart.getPlot(); //获得
plot:XYPlot!!
xyplot.setBackgroundPaint(Color.lightGray); //设定图表数据显示部分背景色
xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
//设定坐标轴与图表数据显示部分距离
xyplot.setDomainGridlinePaint(Color.white); //网格线颜色
xyplot.setRangeGridlinePaint(Color.white);
//获得 renderer 注意这里是XYLineAndShapeRenderer !!
XYLineAndShapeRenderer xylineandshaperenderer =
(XYLineAndShapeRenderer)xyplot.getRenderer();
xylineandshaperenderer.setShapesVisible(true); //数据点可见
xylineandshaperenderer.setShapesFilled(true); //数据点被填充即不是空心点
NumberAxis numberaxis = (NumberAxis)xyplot.getRangeAxis();
numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
return jfreechart;
}
一些重要的方法:
XYLineAndShapeRenderer xylineandshaperenderer = new
XYLineAndShapeRenderer();
xylineandshaperenderer.setSeriesLinesVisible(0, false);
//第一个XYSeries数据点间连线不可见
xylineandshaperenderer.setSeriesShapesVisible(1, false);
//第二个XYSeries数据点不可见
xyplot.setRenderer(xylineandshaperenderer);