在XML中的定義:
<lecho.lib.hellocharts.view. ComboLineColumnChartView
android:id="@+id/combochart"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</lecho.lib.hellocharts.view. ComboLineColumnChartView >
控件實(shí)例化:
ComboLineColumnChartView comboChart;
comboChart=(ComboLineColumnChartView)findViewById(R.id.combochart);
chart屬性設(shè)置:
comboChart.setZoomEnabled(boolean isZoomEnabled)//設(shè)置是否支持縮放
comboChart.setOnValueTouchListener(ColumnChartOnValueSelectListener touchListener);//為圖表設(shè)置值得觸摸事件
comboChart.setInteractive(boolean isInteractive);//設(shè)置圖表是否可以與用戶互動(dòng)
comboChart.setValueSelectionEnabled(boolean idValueSelectionEnabled);//設(shè)置圖表數(shù)據(jù)是否選中進(jìn)行顯示
comboChart.setComboLineColumnChartData(ComboLineColumnChartData data);//為圖表設(shè)置數(shù)據(jù)墓懂,數(shù)據(jù)類型為ComboLineColumnChartData
設(shè)置ComboLineColumnChartData 屬性及為chart設(shè)置數(shù)據(jù):
ComboLineColumnChartData comboLineColumnChartData=new ComboLineColumnChartData();//定義組合數(shù)據(jù)對(duì)象
comboLineColumnChartData.setLineChartData(LineChartData lineChartData);//為組合圖設(shè)置折線圖數(shù)據(jù)
comboLineColumnChartData.setColumnChartData(ColumnChartData columnChartData);//為組合圖設(shè)置柱形圖數(shù)據(jù)
comboLineColumnChartData.setValueLabelsTextColor(Color.BLACK);// 設(shè)置數(shù)據(jù)文字顏色
comboLineColumnChartData.setValueLabelTextSize(15);// 設(shè)置數(shù)據(jù)文字大小
comboLineColumnChartData.setValueLabelTypeface(Typeface.MONOSPACE);// 設(shè)置數(shù)據(jù)文字樣式
comboLineColumnChartData.setAxisYLeft(axisY);// 將Y軸屬性設(shè)置到左邊
comboLineColumnChartData.setAxisXBottom(axisX);// 將X軸屬性設(shè)置到底部
comboLineColumnChartData.setAxisYRight(axisYRight);//設(shè)置右邊顯示的軸
comboLineColumnChartData.setAxisXTop(axisXTop);//設(shè)置頂部顯示的軸
comboChart.setComboLineColumnChartData(ComboLineColumnChartData data);//為足額和圖添加數(shù)據(jù)
組合圖ComboLineColumnChartData其中添加的數(shù)據(jù)為L(zhǎng)ineChartData和ColumnChartData,與LinChartView亮隙、CoulmnChartView添加的數(shù)據(jù)類型一致。