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

来源:互联网 发布:linux cut uniq 编辑:程序博客网 时间:2024/05/17 01:29

  另一个横向的曲线图(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


0 0
原创粉丝点击