XCL-Charts FIG draw lines (Line Chart)

Disclaimer: This article is a blogger original article, shall not be reproduced without the consent of bloggers.

https://blog.csdn.net/xcltapestry/article/details/25471361

About charts (Line Chart) how to draw, I wrote very specific instructions, just look at this attachment, and now the base class is how to get.

 

The base class for all relevant elements related to the graph can be developed into a controllable, hide specific position calculation, computational latency graphics rendering process, only the incoming data shall source,

Plus control what you want you can get a pretty good chart.


    

   Attach Code:

//线图基类
		chart = new LineChart();
		//图所占范围大小
		chart.setChartRange(0, 0, this.mScrWidth  , this.mScrHeight );
			
		//标签1相应的数据集
		LinkedList<Double> value1= new LinkedList<Double>();	
		value1.add((double)25); 
		value1.add((double)21); 
		value1.add((double)31); 
		value1.add((double)40);
		value1.add((double)35);
		//标签2相应的数据集
		LinkedList<Double> value2= new LinkedList<Double>();	
		value2.add((double)30); 
		value2.add((double)42); 
		value2.add((double)50); 	
		value2.add((double)50); 
		value2.add((double)40); 
		
		//将标签与相应的数据集分别绑定
		LineData lineData1 = new LineData("小熊",(int)Color.rgb(234, 83, 71),value1);
		LineData lineData2 = new LineData("小小熊",(int)Color.rgb(75, 166, 51),value2);		

		//标签集合
		LinkedList<String> lables = new LinkedList<String>();
		lables.add("2010");
		lables.add("2011");
		lables.add("2012");
		lables.add("2013");
		lables.add("2014");
		chart.setLineLables(lables);
		
		//设定数据源
		LinkedList<LineData> chartData = new LinkedList<LineData>();
		chartData.add(lineData1);
		chartData.add(lineData2);				
		chart.setDataSource(chartData);
		
		//图标题
		chart.setTitle("线图(Line Chart)");
		//图例
		chart.setLegend("XCL-Charts");
		
		//数据轴最大值
		chart.setDataAxisMax(100);
		//数据轴刻度间隔
		chart.setDataAxisSteps(10);
		
		//设置标签轴颜色
		chart.getLablesAxisPaint().setColor((int)Color.rgb(22, 107, 164));
		//设置数据轴颜色
		chart.getDataAxisPaint().setColor((int)Color.rgb(252, 210, 9));	
		
		//显示分隔色
		chart.isShowInnerLineInterval(false);
		//设置分隔色
		//chart.setInnerLineIntervalColor((int)Color.rgb(239, 239, 239));
		
		//显示横向分隔网线
		chart.isShowInnerHorizontalLine(true);
		//显示竖向分隔网线
		chart.isShowInnerVerticalLine(true);
		
		//显示横向分隔网线颜色
		chart.setInnerHorizontalLineStyle(1,(int)Color.rgb(218, 218, 218));
		//显示竖向分隔网线颜色
		chart.setInnerVerticalLineStyle(1,(int)Color.rgb(218, 218, 218));
				
		//线条粗细
		chart.setLineStyle(5);
		//点上显示圆心
		chart.setDotStyle(XTypes.LineDotStyle.Circle);
		//点上圆心半径
		chart.setLineDotRadius(8);
		//点上显示标签
		chart.isShowDotLabel(true);
		
		//设置标签轴标签 偏移量,旋转角度
		chart.setPaintStyle(XTypes.LineTextPaintType.LABLESAXIS_LABLES,10,-45f);

MAIL: [email protected]

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



Guess you like

Origin www.cnblogs.com/mqxnongmin/p/10960445.html