在XML中的定义:
<lecho.lib.hellocharts.view.BubbleChartView
android:id="@+id/bubblechart"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</lecho.lib.hellocharts.view.BubbleChartView>
控件实例化:
BubbleChartView bubbleChart;
bubbleChart = (BubbleChartView) findViewById(R.id.bubblechart);
chart属性设置:
bubbleChart.setZoomEnabled(boolean isZoomEnabled)
bubbleChart.setOnValueTouchListener(LineChartOnValueSelectListener touchListener);
bubbleChart.setInteractive(boolean isInteractive);
bubbleChart.setValueSelectionEnabled(boolean isSelection);
设置节点、X、Y轴属性:
List<BubbleValue> pointValues = new ArrayList<BubbleValue>();
Axis axisY = new Axis().setHasLines(true);
Axis axisX = new Axis();
axisY.setName(String yName);
axisX.setName(String xName);
ArrayList<AxisValue> axisValuesX = new ArrayList<AxisValue>();
ArrayList<AxisValue> axisValuesY = new ArrayList<AxisValue>();
axisX.setValues(axisValuesX);
axisX.setLineColor(Color.BLACK);
axisY.setLineColor(Color.BLACK);
axisX.setTextColor(Color color);
axisY.setTextColor(Color color);
axisX.setTextSize(14);
axisX.setTypeface(Typeface.DEFAULT);
axisX.setHasTiltedLabels(bolean isHasTit);
axisX.setHasLines(boolean isHasLines);
axisY.setHasLines(boolean isHasLines);
axisX.setHasSeparationLine(boolean isHasSeparationLine);
axisX.setInside(boolean isInside);
BubbleValue v=new BubbleValue();
v.set(float x,float y,float z);
v.setColor(int color);
v.setLabel(String label);
v.setShape(ValueShape shape);
设置BubbleChartData属性及为chart设置数据:
BubbleChartData bubbleDate=new BubbleChartData(List<BubbleValue> values);
bubbleDate.setBubbleScale(float bubbleScale);
bubbleDate.setHasLabelsOnlyForSelected(boolean hasLabelsOnlyForSelected);
bubbleDate.setMinBubbleRadius(int minBubbleRadius);
bubbleDate.setValueLabelsTextColor(Color.BLACK);
bubbleDate.setValueLabelTextSize(15);
bubbleDate.setValueLabelTypeface(Typeface.MONOSPACE);
bubbleDate.setAxisYLeft(axisY);
bubbleDate.setAxisXBottom(axisX);
bubbleDate.setAxisYRight(axisYRight);
bubbleDate.setAxisXTop(axisXTop);
bubbleChart.setBubbleChartData(BubbleChartData bubbleChartData);