XCL-Charts画曲线图(CurveChart) 例2

  还有一个横向的曲线图(CurveChart)

    效果:

      

代码:

//图基类
				chart = new CurveChart();
				//图所占范围大小
				chart.setChartRange(0, 0, this.mScrWidth  , this.mScrHeight );
				
				//标签轴标签集合
				LinkedList<String> lables = new LinkedList<String>();
				lables.add("2010");
				lables.add("2011");
				lables.add("2012");
				lables.add("2013");
				lables.add("2014");
				chart.setLineLables(lables);
				
				//线1的数据集
				LinkedHashMap<Double,Double> linePoint1 = new LinkedHashMap<Double,Double>();
				linePoint1.put(10d, 30d);
				linePoint1.put(25d, 40d);
				linePoint1.put(60d, 35d);
				linePoint1.put(75d, 50d);
				CurveData curveData1 = new CurveData("青菜萝卜够吃",
						(int)Color.rgb(54, 141, 238) ,linePoint1);
				//线2的数据集
				LinkedHashMap<Double,Double> linePoint2 = new LinkedHashMap<Double,Double>();
				linePoint2.put(40d, 40d);
				linePoint2.put(55d, 55d);
				linePoint2.put(70d, 45d);
				linePoint2.put(85d, 25d);				
				CurveData curveData2 = new CurveData("饭管够",
						(int)Color.rgb(255, 165, 132) ,
						linePoint2,XTypes.LineDotStyle.Rect,(int)Color.rgb(234, 83, 71));
								
				//设定数据源
				LinkedList<CurveData> chartData = new LinkedList<CurveData>();
				chartData.add(curveData1);				
				chartData.add(curveData2);	
				chart.setDataSource(chartData);
				
				//图标题
				chart.setTitle("曲线图(Curve Chart)", 33, Color.WHITE);
				//图例
				chart.setLegend("XCL-Charts");			
				
				//数据轴最大值
				chart.setDataAxisMax(70);
				//数据轴刻度间隔
				chart.setDataAxisSteps(10);				
				//标签轴最大值
				chart.setLablesAxisMax(100);		
				
				//显示横向分隔网线
				chart.isShowInnerHorizontalLine(true);						
				//显示横向分隔网线粗细及颜色
				chart.setInnerHorizontalLineStyle(1,(int)Color.rgb(218, 218, 218));
									
				//线条粗细
				chart.setLineStyle(5);			
				//点上显示圆心
				chart.setLineDotRadius(6);
				//点上显示标签
				chart.isShowDotLabel(true);				
				//设置标签轴标签 偏移量,旋转角度
				chart.setPaintStyle(XTypes.LineTextPaintType.LABLESAXIS_LABLES,10,45f);
				
				//相关标签设为白色显示
				chart.getPaintLables().setColor(Color.WHITE);
				chart.getPaintLegent().setColor(Color.WHITE);
				chart.getPaintTitle().setColor(Color.WHITE);
				
				//将轴隐藏起来
				chart.isShowDataAxis(false);
				chart.isShowLablesAxis(false);
				
				//显示背景(默觉得白色)
				chart.isShowChartInner(true);

样例集中展示:  自己写的Android图表库XCL-Charts样例集中展示(会持续更新)


MAIL: xcl_168@aliyun.com

BLOG: http://blog.csdn.net/xcl168


posted @ 2014-05-29 14:25  blfshiye  阅读(457)  评论(0编辑  收藏  举报